Input Group
Combines input with prefix/suffix elements.
When to Use
Use Input Group when you need to:
- Add context to input fields with icons, labels, or units
- Combine inputs with action buttons (search, copy, submit)
- Display prefix/suffix text like currency symbols or domain names
- Group related form controls visually (quantity with +/- buttons)
- Provide inline help via tooltips without cluttering the UI
Default
Input groups combine inputs with icons, text, and buttons for enhanced functionality.
With Icons
Add icons to indicate input purpose or provide visual feedback.
With Text
Display additional text information alongside inputs, like currency symbols or domain suffixes.
With Buttons
Add interactive buttons for actions like copy, toggle favorites, or search.
With Tooltips
Provide additional context or help information via tooltips.
With Textarea
Input groups also work with textareas. Use block-start or block-end alignment.
With Dropdown
Pair input groups with dropdown menus for complex interactions.
With Button Group
Combine input groups with button groups for prefix/suffix wrappers.
UX & Design Guidelines
Visual Hierarchy
Addons should provide context, not compete for attention. Use muted colors for icons and text addons, reserving emphasis for action buttons. Keep addon content concise—long text disrupts the visual balance.
Alignment Strategy
inline-start/inline-end— Use with single-line inputs for horizontal addonsblock-start/block-end— Use with textareas for vertical stacking- Place icons at
inline-startto indicate input type (search, email) - Place action buttons at
inline-endfor natural reading flow
Responsive Behavior
Input groups maintain their structure across breakpoints. On narrow screens, consider using icon-only buttons (size="icon-xs") instead of text buttons. Use max-w-sm or similar constraints to prevent overly wide inputs on large screens.
Color & Contrast
Addon text uses text-muted-foreground for subtle distinction. Focus states apply to the entire group with a visible ring. Error states use border-destructive and ring-destructive for clear feedback.
Accessibility
Keyboard Navigation
- Tab — Move focus between input and addon buttons
- Enter or Space — Activate focused button
- Escape — Close dropdown menus or tooltips
- Arrow keys work within dropdown menus when open
Screen Reader Support
- The container uses
role="group"to announce related controls - Clicking non-button addons focuses the input automatically
- Icon-only buttons must have
aria-label - Use
aria-describedbyto connect helper text to the input - Prefix/suffix text is read before/after the input value
Focus Management
Focus indicator wraps the entire group with a 3px ring using focus-visible:ring-[3px]. This unified focus state helps users understand the group as a single control. Tab order follows DOM order—place inputs before addons for logical navigation.
Touch Targets
Addon buttons have minimum dimensions of 24×24px (size="icon-xs") or 32×32px (size="icon-sm") for comfortable touch interaction. Use the larger size on mobile-first designs.
ARIA Attributes
<InputGroup aria-labelledby="search-label">
<InputGroupInput
placeholder="Search..."
aria-describedby="search-helper"
/>
<InputGroupAddon align="inline-end">
<InputGroupButton aria-label="Submit search">
<Search className="size-4" />
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
<span id="search-label" className="sr-only">Search products</span>
<span id="search-helper" className="text-sm text-muted-foreground">
Enter keywords to search
</span>Related Components
API Reference
InputGroup
The main container that wraps inputs and addons.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Additional CSS classes to apply to the input group container. |
| role | string | "group" | ARIA role for accessibility (automatically set). |
InputGroupAddon
Displays icons, text, buttons, or other content alongside inputs.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "inline-start" | "inline-end" | "block-start" | "block-end" | "inline-start" | Position of the addon relative to the input. |
| className | string | — | Additional CSS classes to apply to the addon. |
InputGroupButton
Buttons within input groups with specialized sizing.
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "icon-xs" | "sm" | "icon-sm" | "xs" | Size of the button. |
| variant | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "ghost" | Visual style variant of the button. |
InputGroupInput
Replacement for Input when building input groups.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Additional CSS classes. All standard input props are supported. |
InputGroupTextarea
Replacement for Textarea when building input groups.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Additional CSS classes. All standard textarea props are supported. |