--- title: Input Group description: Display additional information or actions to an input or textarea. component: true --- import { IconInfoCircle } from "@tabler/icons-react" ## Installation CLI Manual ```bash npx shadcn@latest add input-group ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, } from "@/components/ui/input-group" ``` ```tsx showLineNumbers Search ``` ## Examples ### Icon ### Text Display additional text information alongside inputs. ### Button Add buttons to perform actions within the input group. ### Tooltip Add tooltips to provide additional context or help. ### Textarea Input groups also work with textarea components. Use `block-start` or `block-end` for alignment. ### Spinner Show loading indicators while processing input. ### Label Add labels within input groups to improve accessibility. ### Dropdown Pair input groups with dropdown menus for complex interactions. ### Button Group Wrap input groups with button groups to create prefixes and suffixes. ### Custom Input Add the `data-slot="input-group-control"` attribute to your custom input for automatic behavior and focus state handling. No style is applied to the custom input. Apply your own styles using the `className` prop. ```tsx showLineNumbers import { InputGroup, InputGroupAddon } from "@/component/ui/input-group" import TextareaAutosize from "react-textarea-autosize" export function InputGroupCustom() { return ( how ) } ``` ## API Reference ### InputGroup The main component that wraps inputs and addons. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx ``` ### InputGroupAddon Displays icons, text, buttons, or other content alongside inputs. } title="Focus Navigation"> For proper focus navigation, the `InputGroupAddon` component should be placed after the input. Set the `align` prop to position the addon. | Prop | Type | Default | | ----------- | ---------------------------------------------------------------- | ---------------- | | `align` | `"inline-start" \| "inline-end" \| "block-start" \| "block-end"` | `"inline-start"` | | `className` | `string` | | ```tsx ``` **For ``, use the `inline-start` or `inline-end` alignment. For ``, use the `block-start` or `block-end` alignment.** The `InputGroupAddon` component can have multiple `InputGroupButton` components and icons. ```tsx Button Button ``` ### InputGroupButton Displays buttons within input groups. | Prop | Type | Default | | ----------- | ----------------------------------------------------------------------------- | --------- | | `size` | `"xs" \| "icon-xs" \| "sm" \| "icon-sm"` | `"xs"` | | `variant` | `"default" \| "destructive" \| "outline" \| "secondary" \| "ghost" \| "link"` | `"ghost"` | | `className` | `string` | | ```tsx Button ``` ### InputGroupInput Replacement for `` when building input groups. This component has the input group styles pre-applied and uses the unified `data-slot="input-group-control"` for focus state handling. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | All other props are passed through to the underlying `` component. ```tsx ``` ### InputGroupTextarea Replacement for `