Input Group
Compound field with dockable addons — icons, text, buttons, and hints arranged inline or stacked around an input or textarea. Size, variant, and invalid state cascade from the group, and block + inline addons compose freely.
Installation#
pnpm dlx shadcn@latest add @davinciui/input-groupUsage#
Composition
InputGroup auto-arranges its children by align: block addons stack above and below, everything else shares one middle row in JSX order — no wrapper divs to think about. Icons, text, buttons, kbd hints, and selects all dock as addons around a borderless field.
Align#
inline-start#
inline-end#
block-start#
block-end#
Icon#
Text#
Button#
Kbd#
Dropdown#
Spinner#
Textarea#
Custom Input#
Mixed#
Sizes#
Variants#
Invalid#
Buttons#
URL#
Copy#
Clearable#
RTL#
Composition#
Use the following composition to build a Input Group:
InputGroup
├── InputGroupAddon
│ ├── InputGroupButton
│ └── InputGroupText
├── InputGroupInput
└── InputGroupTextareaAPI Reference#
| Prop | Type | Default |
|---|---|---|
InputGroup · sizeHeight / density, inherited by the field, icons, and buttons. | "sm" | "default" | "lg" | "default" |
InputGroup · variantFrame treatment, matching Input. | "default" | "filled" | "ghost" | "underline" | "default" |
InputGroup · invalidPaints the error ring and marks the inner field invalid. | boolean | false |
InputGroupAddon · alignAddon placement; block + inline addons compose in one group. | "inline-start" | "inline-end" | "block-start" | "block-end" | "inline-start" |
InputGroupInput · invalidShorthand for aria-invalid on the field. | boolean | false |
InputGroupTextarea · invalidShorthand for aria-invalid on the field. | boolean | false |
InputGroupTextStatic muted text (prefixes, suffixes, units) docked as an addon. | span element | — |
InputGroupButton · sizeDocked button density; icon sizes render square buttons. | "xs" | "sm" | "icon-xs" | "icon-sm" | "xs" |
InputGroupButton · variantDocked button treatment. | "default" | "secondary" | "outline" | "ghost" | "destructive" | "default" |
Accessibility#
Renders a real input or textarea with aria-invalid cascading from the group, plus native button semantics for addon buttons. Addons are plain divs with no roles; label the inner field and mark decorative addon icons aria-hidden yourself.
Motion#
Frame border, box-shadow, and background transition over 150ms ease-out, with motion-reduce:transition-none disabling them. Addon buttons also use a 150ms color transition; there is no movement or keyframe animation.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

