Overview
Get Started
Components
- Accordion
- Alert Dialog
- Alert
- Autocomplete
- Avatar
- Badge
- Button Group
- Button
- Calendar
- Checkbox Group
- Checkbox
- Collapsible
- Combobox
- Command
- Dialog
- Field
- Form
- Input Group
- Input
- Kbd
- Label
- Menu
- Meter
- Navigation Menu
- Number Field
- Number InputNew
- OTP Field
- Pagination
- Popover
- Radio Group
- Scroll Area
- Select
- Sheet
- Sidebar
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Tooltip
Input Group
A component for grouping input elements with addons, buttons, and helper content.
12 results
import { IconSearch } from "@tabler/icons-react";
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group";
export function InputGroupDemo() {
return (
<InputGroup className="max-w-xs">
<InputGroupInput placeholder="Search..." />
<InputGroupAddon>
<IconSearch />
</InputGroupAddon>
<InputGroupAddon align="inline-end">
<InputGroupText>12 results</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
}Installation
pnpm dlx @zbmui/cli@latest add input-group
Usage
import { IconSearch } from "@tabler/icons-react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/registry/default/ui/input-group";<InputGroup>
<InputGroupInput placeholder="Search..." />
<InputGroupAddon>
<IconSearch />
</InputGroupAddon>
</InputGroup>Examples
Align
Inline Start
Icon positioned at the start.
import { IconSearch } from "@tabler/icons-react";
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export function InputGroupDemo() {
return (
<Field className="max-w-xs">
<FieldLabel>Input</FieldLabel>
<InputGroup>
<InputGroupInput placeholder="Search..." />
<InputGroupAddon align="inline-start">
<IconSearch className="text-muted-foreground" />
</InputGroupAddon>
</InputGroup>
<FieldDescription>Icon positioned at the start.</FieldDescription>
</Field>
);
}Inline End
Icon positioned at the end.
import { IconEyeOff } from "@tabler/icons-react";
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export function InputGroupDemo() {
return (
<Field className="max-w-xs">
<FieldLabel>Input</FieldLabel>
<InputGroup>
<InputGroupInput type="password" placeholder="Enter password" />
<InputGroupAddon align="inline-end">
<IconEyeOff />
</InputGroupAddon>
</InputGroup>
<FieldDescription>Icon positioned at the end.</FieldDescription>
</Field>
);
}Block Start
Full Name
Header positioned above the input.
script.js
Header positioned above the textarea.
import { IconCopy, IconFileCode } from "@tabler/icons-react";
import { Field, FieldControl, FieldDescription, FieldLabel } from "@/components/ui/field";
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
InputGroupText,
InputGroupTextarea,
} from "@/components/ui/input-group";
export function InputGroupDemo() {
return (
<div className="w-full max-w-sm space-y-6">
<Field>
<FieldLabel>Input</FieldLabel>
<InputGroup className="h-auto">
<InputGroupInput placeholder="Enter your name" />
<InputGroupAddon align="block-start">
<InputGroupText>Full Name</InputGroupText>
</InputGroupAddon>
</InputGroup>
<FieldDescription>Header positioned above the input.</FieldDescription>
</Field>
<Field>
<FieldLabel>Textarea</FieldLabel>
<InputGroup>
<FieldControl
render={
<InputGroupTextarea
placeholder="console.log('Hello, world!');"
className="font-mono"
/>
}
/>
<InputGroupAddon align="block-start">
<IconFileCode className="text-muted-foreground" />
<InputGroupText className="font-mono">script.js</InputGroupText>
<InputGroupButton size="icon-xs" className="ml-auto rounded-sm">
<IconCopy />
<span className="sr-only">Copy</span>
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
<FieldDescription>Header positioned above the textarea.</FieldDescription>
</Field>
</div>
);
}Block End
USD
Footer positioned below the input.
0/280
Footer positioned below the textarea.
import { Field, FieldControl, FieldDescription, FieldLabel } from "@/components/ui/field";
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
InputGroupText,
InputGroupTextarea,
} from "@/components/ui/input-group";
export function InputGroupDemo() {
return (
<div className="w-full max-w-sm space-y-6">
<Field>
<FieldLabel>Input</FieldLabel>
<InputGroup className="h-auto">
<InputGroupInput placeholder="Enter amount" />
<InputGroupAddon align="block-end">
<InputGroupText>USD</InputGroupText>
</InputGroupAddon>
</InputGroup>
<FieldDescription>Footer positioned below the input.</FieldDescription>
</Field>
<Field>
<FieldLabel>Textarea</FieldLabel>
<InputGroup>
<FieldControl render={<InputGroupTextarea placeholder="Write a comment..." />} />
<InputGroupAddon align="block-end">
<InputGroupText>0/280</InputGroupText>
<InputGroupButton variant="primary" className="ml-auto">
Post
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
<FieldDescription>Footer positioned below the textarea.</FieldDescription>
</Field>
</div>
);
}Sizes
12 results
12 results
12 results
12 results
12 results
import { IconSearch } from "@tabler/icons-react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
const sizes = ["xs", "sm", "default", "lg", "xl"] as const;
export function InputGroupDemo() {
return (
<div className="flex flex-col gap-5">
{sizes.map((size) => (
<InputGroup key={size} size={size} className="max-w-xs">
<InputGroupInput placeholder="Search..." />
<InputGroupAddon>
<IconSearch />
</InputGroupAddon>
<InputGroupAddon align="inline-end">12 results</InputGroupAddon>
</InputGroup>
))}
</div>
);
}