8.7k

Input Group

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

Installation

pnpm dlx shadcn@latest add @coss/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>

Examples

With End Icon

With Start Text

With End Text

With Start and End Text

With Number Field

With Tooltip

With Icon Button

With Button

With Badge

With Keyboard Shortcut

With Inner Label

Small Size

Large Size

Disabled

Loading

With Textarea

API Reference

InputGroup

The main component that wraps inputs and addons.

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.

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.

Comparing with shadcn

If you're already familiar with shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss ui quickly.

Quick Checklist

  • No InputGroupButton component - use the regular Button component directly inside InputGroupAddon instead
  • To disable an input group, disable the InputGroupInput or InputGroupTextarea directly (and any Button inside it) - no need to add a data-disabled attribute on InputGroup.

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).