Input
Weight Unit Toggle
A weight or height field with a two-button unit toggle: switching kg to lb (or back) converts the number instead of leaving it unchanged.
React + Tailwind, shadcn-compatible: press “Copy for AI” and your Cursor or Claude Code agent installs it with the shadcn CLI.
What you can change
- the label copy and the unitA/unitB captions
- the factor and the starting defaultValue, defaultUnit
- the wording of the conversion line
A link for your AI agent: preview, code and instructions.
Preview

Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this on the home page as the hero:
https://vibeui.club/c/input-022?lang=en&theme=dark
Not sure where to paste it? Step-by-step guide
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
Loading…
How to use
<Input022
label="Weight"
unitA="kg"
unitB="lb"
factor={2.20462}
onChange={(value, unit) => save(value, unit)}
/>A sample call. The agent installs the component itself from the registry via the “Copy for AI” link.
Settings
- Label
label· default: Weight- Unit A
unitA· default: kg- Unit B
unitB· default: lb- Starting value
defaultValue· default: 72- Accent
accent· default: theme colour- Background
background· default: theme colour
More in Input
FAQ
- How do I add Weight Unit Toggle with Cursor or Claude Code?
- Press “Copy for AI” on this page and paste it into your agent's chat. The instruction contains the shadcn CLI install command, the dependencies and what to keep, so the agent installs this exact component instead of recreating a lookalike.
- What does Weight Unit Toggle depend on?
- No npm packages beyond React and Tailwind CSS.
- What can I change in Weight Unit Toggle?
- Adapt: the label copy and the unitA/unitB captions; the factor and the starting defaultValue, defaultUnit; the wording of the conversion line. Keep as installed: the local --vibeui-input-022-* palette — do not swap it for your theme tokens; converting the number when the unit changes: a kilogram and a pound are the same quantity, not two independent fields; the two-button toggle instead of a dropdown: a list is one extra click for a binary choice.
- Is Weight Unit Toggle free?
- Yes. The preview is open without an account; with a free account you can copy up to 20 components a month.
For developers
npx shadcn@latest add https://vibeui.club/r/pro/input-022.jsonThis command needs a signed link: sign in and open “Component source” below — it issues a working link valid for 30 minutes. All install options
Technical notes
The component is self-contained: one file, no dependencies, its own palette in local variables --vibeui-input-022-*. A client component: "use client". The unit is switched by two buttons with aria-pressed inside a role="group" rather than by a list: for two options a list is one extra level of interaction. On switching, the number is converted by the factor multiplier and rounded to one decimal, and the line under the field shows the equivalent in the other unit.
Tags
- input
- unit
- weight
- toggle
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…