---
title: "Input Group"
description: "One frame around an input or a text area and the parts next to it: icons, text, key hints, and buttons."
url: https://gelatinui.com/components/input-group
markdown_url: https://gelatinui.com/components/input-group.md
access: free
install: "npx shadcn@latest add @gelatin-ui/input-group"
registry_item: https://gelatinui.com/r/input-group.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Input Group

> One frame around an input or a text area and the parts next to it: icons, text, key hints, and buttons.

Page: https://gelatinui.com/components/input-group

## When to use it

Best for: One frame around an Input or a Textarea and its add-ons: icons, text, keys, or buttons.

- Use it to put icons, text, keys, or buttons inside the frame of a field.
- Use `InputGroupAddon align` (`inline-start`, `inline-end`, `block-start`, `block-end`) to place an add-on.
- Use `InputGroupTextarea` with a `block-end` add-on for a composer with a toolbar.
- Use `rounded="full"` for a one-line search field.

## When not to use it

- For a field with no add-on, use an [Input](https://gelatinui.com/components/input.md).
- For a list of options that opens under the field, use a [Combobox](https://gelatinui.com/components/combobox.md).

## Notes for agents

- Use `InputGroupInput` and `InputGroupTextarea` in the group. They take the size of the group.
- Combobox, Autocomplete, and Number Field inputs draw this frame themselves. Do not render `InputGroupInput` inside them.
- A press on an add-on focuses the control. A press on a button, a link, or an input in the add-on stays on that child.
- With `rounded="full"`, give a button add-on `rounded="full"` too. Do not use it with a Textarea or a block add-on.
- In an inline add-on, use `InputGroupButton` with `xs` or `icon-xs`. Use `sm` or `icon-sm` in a block add-on.
- Prefer a ghost or secondary `InputGroupButton` inline. An outline button draws a second border inside the frame.

## Anatomy

```text
InputGroup
├─ InputGroupAddon (0..n)
├─ InputGroupText (0..n)
├─ InputGroupButton (0..n)
├─ InputGroupInput (0..n)
└─ InputGroupTextarea (0..n)
```

## API reference

### InputGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "default" |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "default" |  |
| `variant` | `"dashed" \| "default"` | "default" |  |
| `className` | `string` |  |  |

### InputGroupAddon

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"block-end" \| "block-start" \| "inline-end" \| "inline-start"` | "inline-start" |  |
| `className` | `string` |  |  |

### InputGroupText

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### InputGroupButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `size` | `"icon-sm" \| "icon-xs" \| "sm" \| "xs"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### InputGroupInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` |  |  |

Also takes every prop of Base UI `Input`: https://base-ui.com/react/components/input

### InputGroupTextarea

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `size` | `ControlSizeAtLeastSm` |  | The padding of the box: `sm`, `default`, or `lg` (the height follows the text). |

Also takes every prop of Base UI `Field.Control`: https://base-ui.com/react/components/field

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| InputGroup | `input-group` | `aria-invalid`, `data-align`, `data-disabled`, `data-input-group-control`, `data-stage-focused` | `--input-group-button-disabled-opacity` |  |
| InputGroupAddon | `input-group-addon` | `data-size` |  |  |
| InputGroupText | `input-group-text` | `data-size` |  |  |
| InputGroupButton | `input-group-button` | `aria-pressed`, `data-disabled`, `data-loading`, `data-size` | `--input-group-button-disabled-opacity`, `--radius` | `hit-area` |
| InputGroupInput | `input-group-control` |  |  |  |
| InputGroupTextarea | `input-group-control` |  |  |  |

## Usage

Use `InputGroupInput` or `InputGroupTextarea` in the group. `InputGroupAddon align` places each add-on.

```tsx title="project-search.tsx"
import { MagnifyingGlassIcon } from "@phosphor-icons/react/ssr";

import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";

export function ProjectSearch() {
  return (
    <InputGroup>
      <InputGroupInput aria-label="Search projects" placeholder="Search projects" />
      <InputGroupAddon align="inline-start">
        <MagnifyingGlassIcon />
      </InputGroupAddon>
    </InputGroup>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/input-group
```

It adds 14 registry items: 11 files, 2305 lines, and the npm packages `@base-ui/react`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Input](https://gelatinui.com/components/input.md)
- [Textarea](https://gelatinui.com/components/textarea.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Input](https://gelatinui.com/components/input.md)
- [Textarea](https://gelatinui.com/components/textarea.md)
- [Combobox](https://gelatinui.com/components/combobox.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the control, then to each button in an add-on. |

## Accessibility

The focus ring goes around the whole frame, so it also holds the add-ons.

A press on an add-on focuses the control. A press on a button or a link in the add-on stays on that child.

An icon add-on has no name. Name the input with a `FieldLabel` or an `aria-label`.
