Skip to content

Input Group

A flexible component for grouping inputs with addons, buttons, and other elements.

Installation

pnpm dlx shadcn@latest add @frontal-labs/input-group

Usage

import { Input } from "@/components/ui/input";
import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,
  InputGroupText,
} from "@/components/ui/input-group";
<InputGroup>
  <InputGroupInput type="email" placeholder="Email" />
  <InputGroupAddon>
    <MailIcon />
  </InputGroupAddon>
</InputGroup>

API Reference

InputGroup

The main component that wraps inputs and addons. Carries the border, focus ring and invalid state for the whole group; the inner control renders transparent.

In light mode the group carries a bg-muted fill on top of its border, so an empty group stays visible against a white surface instead of relying on the border alone. When a control inside is disabled the group switches to bg-input/50.

InputGroupAddon

A container for addons like icons, text, buttons, and other elements. Can be positioned at the start or end (inline), or top or bottom (block) of the input.

InputGroupText

A text container component for displaying text content within an InputGroupAddon. Automatically styles text with muted foreground color and handles icon sizing.

InputGroupButton

A Button sized to sit inside an InputGroupAddon.

InputGroupInput

A specialized input component for use within InputGroup. It's essentially an unstyled Input component that inherits styling from the parent InputGroup.

InputGroupTextarea

A specialized textarea component for use within InputGroup. It's essentially an unstyled Textarea component that inherits styling from the parent InputGroup.

Examples

With End Icon

With Start Text

With End Text

With Start and End Text

With Tooltip

With Icon Button

With Button

With Badge

With Keyboard Shortcut

With Inner Label

Disabled

Loading

With Number Field

With Textarea