Input group
v0.17.4An input with an icon, a unit or a button (clear, show password) inside its edge. The group draws the field, focus and error.
Input group search
Install
npx shadcn add @syncrobotic/input-group Also installs: @syncrobotic/cn
Overview
An input with something inside its edge: a search icon, a unit, a clear or show-password button.
When to use
- Search fields with an icon and a clear button.
- Values with a unit (m/s, %).
- Passwords with show / hide.
Use something else
- A number you step through: Number field, which is built on it.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Input group password
Input group unit
Input group with button
Usage rules
- For an icon, a unit or a button inside the field's edge. Use it instead of positioning icons by hand.
- Units are text after the value, so “120 m” reads as one; icons are decorative and hidden from screen readers.
- Buttons inside (clear, show password) need an aria-label; they are 36 px with a mouse and 44 px on touch, like every compact control.
Changelog
- 0.17.42026-11-21Wiring the Field's id onto the first text box no longer reassigns a variable from a callback, so it is safe under the React Compiler. No visible change.
- 0.17.32026-11-19Disabled: the field keeps its grey fill with a --border edge, so in dark mode it no longer looks enabled; its words use the new --disabled (3:1 on every surface).
- 0.15.02026-11-19InputGroupUnit: a unit written right after the value ("120 m"), the value as wide as its text, instead of a unit at the far edge. A press on the field's empty space puts the caret in the text box.