Make your AI a shadcn expert

Shadcn Input Group

React input group for icons, buttons, and addons on inputs. Built with TypeScript and Tailwind CSS for Next.js using Base UI — one focus ring for the whole control.

An input group is one bordered control: the field plus icons, text, buttons, or a kbd. The wrapper owns the border and the focus ring; the inner input is borderless. Use it for search, URL prefixes, password actions, and prompt boxes with a toolbar.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same input group, thicker borders. The NeoBrutalism input group is the kit if you want that look.

Usage

import {
  InputGroup,
  InputGroupAddon,
  InputGroupButton,
  InputGroupInput,
  InputGroupText,
  InputGroupTextarea,
} from "@/components/ui/input-group"
<InputGroup>
  <InputGroupInput placeholder="Search..." />
  <InputGroupAddon>
    <SearchIcon />
  </InputGroupAddon>
</InputGroup>

align on InputGroupAddon places the addon. Put the addon after the input in the DOM so tab lands on the field first.

Composition

InputGroupInput
InputGroupTextarea
InputGroupButton
InputGroupText

Align

align="inline-start" is the default. Also inline-end, block-start, and block-end.

Scroll to load preview...

Icon

Icons in an addon. Click the icon and the input focuses.

Scroll to load preview...

Text

InputGroupText for prefixes, suffixes, and counters.

Scroll to load preview...

Button

InputGroupButton is sized for the group — xs or icon-xs. Ghost by default.

Scroll to load preview...

Kbd

A shortcut hint on the end. The addon rounds nested kbd to match.

Scroll to load preview...

A menu trigger as the addon button — file actions or a search-in picker.

Scroll to load preview...

Spinner

Loading on either side. Pair with muted text if the wait needs a label.

Scroll to load preview...

Textarea

InputGroupTextarea plus block-start / block-end for a header and a toolbar.

Scroll to load preview...

Custom Input

Any control with data-slot="input-group-control" gets the group's focus ring.

Scroll to load preview...

Inline End

Addon on the inline-end edge. Icons and buttons sit after the value.

Scroll to load preview...

Block Start

Addon above the field. A label or a toolbar that belongs to the group.

Scroll to load preview...

Block End

Addon below the field. Helper text that still sits inside the ring.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Addons follow the reading direction.

Scroll to load preview...

API

InputGroup is a div with role="group". Focus and aria-invalid on the control restyle the whole group via has-*.

InputGroupAddon

Prop

Type

InputGroupButton

Prop

Type

InputGroupInput and InputGroupTextarea pass through to Input and Textarea. They set data-slot="input-group-control". InputGroupText is a span.

Notes

Addon after the control

Put InputGroupAddon after InputGroupInput or InputGroupTextarea in the DOM. align is visual only — tab should hit the field first.

aria-invalid on the control tints the whole group's border.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.