Input
A single-line text field with optional prefix and suffix content.
Status: stable. Category: Forms.
import { Input } from '@glyphui/ui'
Exports: Input, inputStyles, fieldControl.
Notes
- className styles the outer frame; use inputClassName for the <input> element itself.
- fieldControl is the shared class list used by Input, Textarea and the Select trigger.
Input props
| Prop | Type | Default | Description |
|---|---|---|---|
inputClassName | string | Classes for the <input> element itself. className styles the outer frame. | |
prefix | ReactNode | Content before the text, e.g. an icon or https://. | |
size | "sm" | "md" | "lg" | ||
suffix | ReactNode | Content after the text, e.g. a unit or a Kbd hint. |
Example: Basic
import { Input } from '@glyphui/ui'
export default function Example() {
return (
<div className="grid max-w-sm gap-3">
<Input aria-label="Project name" placeholder="Project name" />
<Input aria-label="Disabled" placeholder="Disabled" disabled />
</div>
)
}
Example: Prefix and suffix
import { Input, Kbd } from '@glyphui/ui'
import { Globe, Search } from 'lucide-react'
export default function Example() {
return (
<div className="grid max-w-sm gap-3">
<Input aria-label="Workspace URL" prefix="glyph.app/" defaultValue="acme" />
<Input aria-label="Domain" prefix={<Globe />} placeholder="acme.dev" />
<Input aria-label="Search" prefix={<Search />} placeholder="Search" suffix={<Kbd>/</Kbd>} />
<Input aria-label="Price" type="number" defaultValue="24" suffix="USD / month" />
</div>
)
}
Example: Sizes
import { Input } from '@glyphui/ui'
export default function Example() {
return (
<div className="grid max-w-sm gap-3">
<Input size="sm" aria-label="Small" placeholder="Small" />
<Input size="md" aria-label="Medium" placeholder="Medium" />
<Input size="lg" aria-label="Large" placeholder="Large" />
</div>
)
}
Live page: https://glyphui.xyz/components/input