For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
42
Sponsor

Input Group

Group inputs with icons, text, buttons, and addons.

12 results
import { SearchIcon } from "lucide-react";

import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/input-group.json

Usage

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

Composition

The InputGroupAddon component should be placed after the input. Use the align prop to position the addon.

InputGroup
├── InputGroupInput / InputGroupTextarea
└── InputGroupAddon
    ├── InputGroupText
    └── InputGroupButton

Align

Use the align prop on InputGroupAddon to position content. For InputGroupInput, use inline-start or inline-end. For InputGroupTextarea, use block-start or block-end.

inline-start

Icon positioned at the start.

import { SearchIcon } from "lucide-react";

import {
  Field,
  FieldDescription,
  FieldLabel,

inline-end

Icon positioned at the end.

import { EyeOffIcon } from "lucide-react";

import {
  Field,
  FieldDescription,
  FieldLabel,

block-start

Full Name

Header positioned above the input.

script.js

Header positioned above the textarea.

import { CopyIcon, FileCodeIcon } from "lucide-react";

import {
  Field,
  FieldDescription,
  FieldGroup,

block-end

USD

Footer positioned below the input.

0/280

Footer positioned below the textarea.

import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
} from "@/components/ui/field";

Examples

Icon

import {
  CheckIcon,
  CreditCardIcon,
  InfoIcon,
  MailIcon,
  SearchIcon,

Text

$
USD
https://
.com
@company.com
120 characters left
import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,
  InputGroupText,
  InputGroupTextarea,

Button

https://
"use client";

import { CheckIcon, CopyIcon, StarIcon } from "lucide-react";
import { useState } from "react";

import {

Kbd

⌘K
import { SearchIcon } from "lucide-react";

import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,
"use client";

import { ChevronDownIcon, MoreHorizontalIcon } from "lucide-react";

import {
  DropdownMenu,

Spinner

Saving...
Please wait...
import { LoaderIcon } from "lucide-react";

import {
  InputGroup,
  InputGroupAddon,
  InputGroupInput,

Textarea

Line 1, Column 1
script.js
import {
  CopyIcon,
  CornerDownLeftIcon,
  FileCodeIcon,
  RefreshCwIcon,
} from "lucide-react";

Custom Input

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

RTL

To enable right-to-left support, see the RTL guide.

⌘K
"use client";

import { SearchIcon } from "lucide-react";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";

API Reference

InputGroup

The main component that wraps inputs and addons.

PropTypeDefault
classNamestring-

InputGroupAddon

Displays icons, text, buttons, or other content alongside inputs. For proper focus navigation, place it after the input and use the align prop to position it.

PropTypeDefault
align"inline-start" | "inline-end" | "block-start" | "block-end""inline-start"
classNamestring-

InputGroupButton

Displays buttons within input groups.

PropTypeDefault
size"xs" | "icon-xs" | "sm" | "icon-sm""xs"
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""ghost"
classNamestring-

InputGroupInput

Replacement for <Input /> when building input groups. Uses the unified data-slot="input-group-control" for focus state handling.

PropTypeDefault
classNamestring-

InputGroupTextarea

Replacement for <Textarea /> when building input groups. Uses the unified data-slot="input-group-control" for focus state handling.

PropTypeDefault
classNamestring-