- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Input Group
A flexible component for grouping inputs with addons, buttons, and other elements.
import { SearchIcon } from "lucide-react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput aria-label="Search" placeholder="Search" type="search" />
<InputGroupAddon>
<SearchIcon aria-hidden="true" />
</InputGroupAddon>
</InputGroup>
);
}
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.
| Prop | Type | Description |
|---|---|---|
className | string | Additional CSS classes to apply to the component |
...props | React.ComponentProps<'div'> | All standard div attributes are supported |
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.
| Prop | Type | Default | Description |
|---|---|---|---|
align | 'inline-start' | 'inline-end' | 'block-start' | 'block-end' | 'inline-start' | The position of the addon relative to the input. Use inline-start or inline-end for inputs, and block-start or block-end for textareas |
className | string | Additional CSS classes to apply to the component | |
...props | React.ComponentProps<'div'> | All standard div attributes are supported |
For proper focus navigation, the InputGroupAddon component should be placed after the input in
the DOM order.
InputGroupText
A text container component for displaying text content within an InputGroupAddon. Automatically styles text with muted foreground color and handles icon sizing.
| Prop | Type | Description |
|---|---|---|
className | string | Additional CSS classes to apply to the component |
...props | React.ComponentProps<'span'> | All standard span attributes are supported |
InputGroupButton
A Button sized to sit inside an InputGroupAddon.
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'xs' | 'sm' | 'icon-xs' | 'icon-sm' | 'xs' | Controls the button size within the group |
variant | ButtonProps['variant'] | 'ghost' | Button variant used for the rendered button |
type | 'button' | 'submit' | 'reset' | 'button' | Native button type |
InputGroupInput
A specialized input component for use within InputGroup. It's essentially an unstyled Input component that inherits styling from the parent InputGroup.
| Prop | Type | Description |
|---|---|---|
className | string | Additional CSS classes to apply to the component |
...props | InputProps | All props from the Input component are supported, including type, placeholder, disabled, etc. |
InputGroupTextarea
A specialized textarea component for use within InputGroup. It's essentially an unstyled Textarea component that inherits styling from the parent InputGroup.
| Prop | Type | Description |
|---|---|---|
className | string | Additional CSS classes to apply to the component |
...props | TextareaProps | All props from the Textarea component are supported, including placeholder, disabled, rows, etc. |
Examples
With End Icon
import { MailIcon } from "lucide-react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput aria-label="Email" placeholder="Email" type="email" />
<InputGroupAddon align="inline-end">
<MailIcon aria-hidden="true" />
</InputGroupAddon>
</InputGroup>
);
}
With Start Text
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput
aria-label="Set your URL"
className="*:[input]:ps-0!"
placeholder="frontal"
type="search"
/>
<InputGroupAddon>
<InputGroupText>i.cal.com/</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
}
With End Text
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput aria-label="Choose a username" placeholder="Choose a username" type="text" />
<InputGroupAddon align="inline-end">
<InputGroupText>@frontal-labs.com</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
}
With Start and End Text
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput
aria-label="Enter your domain"
className="*:[input]:px-0!"
placeholder="frontal"
type="text"
/>
<InputGroupAddon>
<InputGroupText>https://</InputGroupText>
</InputGroupAddon>
<InputGroupAddon align="inline-end">
<InputGroupText>.com</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
}
With Tooltip
"use client";
import { InfoIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput aria-label="Password" placeholder="Password" type="password" />
<InputGroupAddon align="inline-end">
<Popover>
<PopoverTrigger
nativeButton
openOnHover
render={<Button aria-label="Password requirements" size="icon-xs" variant="ghost" />}
>
<InfoIcon />
</PopoverTrigger>
<PopoverContent side="top">
<p>Min. 8 characters</p>
</PopoverContent>
</Popover>
</InputGroupAddon>
</InputGroup>
);
}
With Icon Button
"use client";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useRef } from "react";
import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard";
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
export default function Particle() {
const { copyToClipboard, isCopied } = useCopyToClipboard();
const inputRef = useRef<HTMLInputElement>(null);
return (
<InputGroup>
<InputGroupInput
aria-label="Url"
defaultValue="https://ui.frontal.dev"
ref={inputRef}
type="text"
/>
<InputGroupAddon align="inline-end">
<Tooltip>
<TooltipTrigger
render={
<Button
aria-label="Copy"
onClick={() => {
if (inputRef.current) {
copyToClipboard(inputRef.current.value);
}
}}
size="icon-xs"
variant="ghost"
/>
}
>
{isCopied ? <CheckIcon /> : <CopyIcon />}
</TooltipTrigger>
<TooltipContent>
<p>Copy to clipboard</p>
</TooltipContent>
</Tooltip>
</InputGroupAddon>
</InputGroup>
);
}
With Button
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput placeholder="Type to search…" type="search" />
<InputGroupAddon align="inline-end">
<Button size="xs" variant="secondary">
Search
</Button>
</InputGroupAddon>
</InputGroup>
);
}
With Badge
import { Badge } from "@/components/ui/badge";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput placeholder="Type to search…" type="search" />
<InputGroupAddon align="inline-end">
<Badge variant="secondary">Badge</Badge>
</InputGroupAddon>
</InputGroup>
);
}
With Keyboard Shortcut
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Kbd } from "@/components/ui/kbd";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput placeholder="Search…" type="search" />
<InputGroupAddon align="inline-end">
<Kbd>⌘K</Kbd>
</InputGroupAddon>
</InputGroup>
);
}
With Inner Label
"use client";
import { InfoIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Label } from "@/components/ui/label";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput id="email-1" placeholder="team@frontal-labs.com" type="email" />
<InputGroupAddon align="block-start">
<Label className="text-foreground" htmlFor="email-1">
Email
</Label>
<Popover>
<PopoverTrigger
className="ml-auto"
nativeButton
openOnHover
render={<Button className="-m-1" size="icon-xs" variant="ghost" />}
>
<InfoIcon />
</PopoverTrigger>
<PopoverContent side="top">
<p>We'll use this to send you notifications</p>
</PopoverContent>
</Popover>
</InputGroupAddon>
</InputGroup>
);
}
Disabled
import { ArrowRightIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput
aria-label="Subscribe to our newsletter"
disabled
placeholder="Your best email"
type="email"
/>
<InputGroupAddon align="inline-end">
<Button aria-label="Subscribe" disabled size="icon-xs" variant="ghost">
<ArrowRightIcon aria-hidden="true" />
</Button>
</InputGroupAddon>
</InputGroup>
);
}
Loading
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Spinner } from "@/components/ui/spinner";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput disabled placeholder="Searching…" type="search" />
<InputGroupAddon align="inline-end">
<Spinner />
</InputGroupAddon>
</InputGroup>
);
}
With Number Field
import { InputGroup, InputGroupAddon, InputGroupText } from "@/components/ui/input-group";
import { NumberField, NumberFieldInput } from "@/components/ui/number-field";
export default function Particle() {
return (
<InputGroup>
<NumberField aria-label="Enter the amount" defaultValue={10}>
<NumberFieldInput className="text-left" />
</NumberField>
<InputGroupAddon>
<InputGroupText>€</InputGroupText>
</InputGroupAddon>
<InputGroupAddon align="inline-end">
<InputGroupText>EUR</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
}
With Textarea
"use client";
import { ArrowUpIcon, PlusIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
InputGroup,
InputGroupAddon,
InputGroupText,
InputGroupTextarea,
} from "@/components/ui/input-group";
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "@/components/ui/menu";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
export default function Particle() {
return (
<InputGroup>
<InputGroupTextarea placeholder="Ask, Search or Chat…" />
<InputGroupAddon align="block-end">
<Menu>
<Tooltip>
<TooltipTrigger
render={
<MenuTrigger
render={
<Button
aria-label="Add files"
className="rounded-full"
size="icon-sm"
variant="ghost"
/>
}
>
<PlusIcon />
</MenuTrigger>
}
/>
<TooltipContent>Add files and more</TooltipContent>
</Tooltip>
<MenuPopup align="start">
<MenuItem>Add photos & files</MenuItem>
<MenuItem>Create image</MenuItem>
<MenuItem>Thinking</MenuItem>
<MenuItem>Deep research</MenuItem>
</MenuPopup>
</Menu>
<InputGroupText className="ml-auto">78% used</InputGroupText>
<Tooltip>
<TooltipTrigger
render={
<Button aria-label="Send" className="rounded-full" size="icon-sm" variant="default">
<ArrowUpIcon />
</Button>
}
/>
<TooltipContent>Send</TooltipContent>
</Tooltip>
</InputGroupAddon>
</InputGroup>
);
}
On This Page