Input Group
Input with leading and trailing addons, icons and buttons.
Installation
bun add @xerobi/ui
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "@xerobi/ui/input-group"This component is client-side. In Astro, hydrate it with a client directive.
Examples
With leading icon
import { CheckCircle2Icon, SearchIcon } from "lucide-react"
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@xerobi/ui/input-group"
export function InputGroupIcon() {
return (
<InputGroup className="w-72">
<InputGroupAddon>
<SearchIcon />
</InputGroupAddon>
<InputGroupInput placeholder="Search" aria-label="Search" />
</InputGroup>
)
}With text and status
import { CheckCircle2Icon, SearchIcon } from "lucide-react"
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@xerobi/ui/input-group"
export function InputGroupStatus() {
return (
<InputGroup className="w-72">
<InputGroupInput defaultValue="xerobi" aria-label="Subdomain" />
<InputGroupAddon align="inline-end">
<InputGroupText>.workers.dev</InputGroupText>
<CheckCircle2Icon className="text-success" />
</InputGroupAddon>
</InputGroup>
)
}Variants
| align | inline-start, inline-end, block-start, block-end |
| size | xs, sm, icon-xs, icon-sm |
API reference
InputGroup
Also accepts every prop of <div> element.
No props of its own.
InputGroupAddon
Also accepts every prop of <div> element.
| Prop | Type | Description |
|---|---|---|
| align | "inline-end" | "inline-start" | "block-end" | "block-start" |
InputGroupButton
| Prop | Type | Description |
|---|---|---|
| color | "info" | "success" | "warning" | "secondary" | "inherit" | "primary" | "error" | |
| variant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "soft" | |
| loading | boolean | |
| disableRipple | boolean | Turns off the press ripple. |
| size | "xs" | "sm" | "icon-xs" | "icon-sm" | |
| type | "button" | "submit" | "reset" |
InputGroupInput
Also accepts every prop of <input> element.
No props of its own.
InputGroupText
Also accepts every prop of <span> element.
No props of its own.
InputGroupTextarea
Also accepts every prop of <textarea> element.
No props of its own.
Styling hooks: [data-slot="input-group"], [data-slot="input-group-addon"], [data-slot="input-group-control"].