Shadcn Input Group
React input group for icons, buttons, and addons on inputs. Built with TypeScript and Tailwind CSS for Next.js using Base UI — one focus ring for the whole control.
An input group is one bordered control: the field plus icons, text, buttons, or a kbd. The wrapper owns the border and the focus ring; the inner input is borderless. Use it for search, URL prefixes, password actions, and prompt boxes with a toolbar.
Looking for a neobrutalism version for shadcn?
Same input group, thicker borders. The NeoBrutalism input group is the kit if you want that look.
Usage
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
InputGroupText,
InputGroupTextarea,
} from "@/components/ui/input-group"<InputGroup>
<InputGroupInput placeholder="Search..." />
<InputGroupAddon>
<SearchIcon />
</InputGroupAddon>
</InputGroup>align on InputGroupAddon places the addon. Put the addon after the input in the DOM so tab lands on the field first.
Composition
Align
align="inline-start" is the default. Also inline-end, block-start, and block-end.
Icon
Icons in an addon. Click the icon and the input focuses.
Text
InputGroupText for prefixes, suffixes, and counters.
Button
InputGroupButton is sized for the group — xs or icon-xs. Ghost by default.
Kbd
A shortcut hint on the end. The addon rounds nested kbd to match.
Dropdown
A menu trigger as the addon button — file actions or a search-in picker.
Spinner
Loading on either side. Pair with muted text if the wait needs a label.
Textarea
InputGroupTextarea plus block-start / block-end for a header and a toolbar.
Custom Input
Any control with data-slot="input-group-control" gets the group's focus ring.
Inline End
Addon on the inline-end edge. Icons and buttons sit after the value.
Block Start
Addon above the field. A label or a toolbar that belongs to the group.
Block End
Addon below the field. Helper text that still sits inside the ring.
RTL
Wrap with DirectionProvider and dir="rtl". Addons follow the reading direction.
API
InputGroup is a div with role="group". Focus and aria-invalid on the control restyle the whole group via has-*.
InputGroupAddon
Prop
Type
InputGroupButton
Prop
Type
InputGroupInput and InputGroupTextarea pass through to Input and Textarea. They set data-slot="input-group-control". InputGroupText is a span.
Notes
Addon after the control
Put InputGroupAddon after InputGroupInput or InputGroupTextarea in the DOM. align is visual only — tab should hit the field first.
aria-invalid on the control tints the whole group's border.
With other components
The field inside
TextareaMulti-line groups
ButtonCompact group actions
KbdShortcut on the end
Dropdown MenuFilter or model picker
SpinnerLoading in an addon
Questions
Related
Was this page helpful?
Sign in to leave feedback.
Input
React input for emails, search, and file uploads. Built with TypeScript and Tailwind CSS for Next.js using Base UI — labels, invalid state, and field groups.
Input OTP
React OTP input for 2FA codes, PINs, and SMS verification. Built with TypeScript and Tailwind CSS for Next.js using Base UI — paste a code and every slot fills.