An input with icons, text, buttons or a keyboard hint attached, sharing one border and focus ring.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
- @tabler/icons-react
- class-variance-authority
Code
"use client"
import * as React from "react"
import { IconArrowUp, IconLock, IconSearch } from "@tabler/icons-react"
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupClear,
InputGroupCount,
InputGroupInput,
InputGroupPasswordToggle,
InputGroupTextarea,
} from "@/components/ui/input-group"
export function InputGroupDemo() {
const [message, setMessage] = React.useState("")
return (
<div className="flex w-full max-w-sm flex-col gap-4">
<InputGroup>
<InputGroupInput
type="search"
defaultValue="Accordion"
placeholder="Search components"
aria-label="Search components"
/>
<InputGroupAddon>
<IconSearch />
</InputGroupAddon>
<InputGroupAddon align="inline-end">
<InputGroupClear />
</InputGroupAddon>
</InputGroup>
<InputGroup>
<InputGroupInput
type="password"
defaultValue="hunter2-but-longer"
autoComplete="current-password"
aria-label="Password"
/>
<InputGroupAddon>
<IconLock />
</InputGroupAddon>
<InputGroupAddon align="inline-end">
<InputGroupPasswordToggle />
</InputGroupAddon>
</InputGroup>
<InputGroup>
<InputGroupTextarea
value={message}
onChange={(event) => setMessage(event.target.value)}
maxLength={140}
placeholder="Leave a note for the team"
aria-label="Note"
/>
<InputGroupAddon align="block-end">
<InputGroupCount />
<InputGroupButton
variant="default"
size="icon-xs"
aria-label="Post note"
disabled={!message.trim()}
className="ms-auto"
>
<IconArrowUp />
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
</div>
)
}
































