Input Group
Display additional information or actions inside an input.
Installation
pnpm dlx cubix@latest add input-group --base radixUsage
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
InputGroupText,
InputGroupTextarea,
} from "@/components/cubix/input-group"<InputGroup>
<InputGroupInput placeholder="Search..." />
<InputGroupAddon>
<SearchIcon />
</InputGroupAddon>
</InputGroup>Composition
Use the following composition to build an InputGroup:
InputGroup
├── InputGroupInput or InputGroupTextarea
├── InputGroupAddon
├── InputGroupButton
└── InputGroupTextAlign
Use the align prop on InputGroupAddon to position the addon relative to the input. For proper focus management, place InputGroupAddon after the control in the DOM and use align for visual position.
inline-start
Use align="inline-start" to position the addon at the start of the input. This is the default.
Icon positioned at the start.
inline-end
Use align="inline-end" to position the addon at the end of the input.
Icon positioned at the end.
block-start
Use align="block-start" to position the addon above the input.
Header positioned above the input.
Header positioned above the textarea.
block-end
Use align="block-end" to position the addon below the input.
Footer positioned below the input.
Footer positioned below the textarea.
Icon
Text
Button
Kbd
Dropdown
Spinner
Textarea
API Reference
InputGroup
The main component that wraps inputs and addons.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
InputGroupAddon
Displays icons, text, buttons, or other content alongside inputs. Place it after the input in the DOM and set align for visual position. Prefer inline-* with InputGroupInput and block-* with InputGroupTextarea.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "inline-start" | "inline-end" | "block-start" | "block-end" | "inline-start" | Visual position of the addon. Place the addon after the control in the DOM for focus management. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
InputGroupButton
Displays buttons within input groups.
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "icon-xs" | "sm" | "icon-sm" | "xs" | Size of the button inside the input group. |
| variant | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "ghost" | Visual style of the button. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
InputGroupInput
Replacement for Input inside groups. Uses data-slot="input-group-control" for focus styling.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
InputGroupTextarea
Replacement for Textarea inside groups.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
InputGroupText
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |