@hacline/ui/inputInput
A text input built on @ui-sdk/react/input supporting variants and sizes, InputGroup prefix/suffix composition, one-click clearing, and input filtering.
Imports
import {
Input,
InputAddon,
InputClear,
InputGroup,
} from "@/components/ui/hacline/components/input";Variants
Switch between the standard outline (default) and filled background (filled) styles via variant.
<Input placeholder="Default outline (default)" />
<Input placeholder="Filled background (filled)" variant="filled" />Sizes
Supports three sizes — sm, md (default), and lg — aligned with Button heights.
<Input placeholder="Small (sm)" size="sm" />
<Input placeholder="Medium (md)" size="md" />
<Input placeholder="Large (lg)" size="lg" />Input Group & Clear Button
Wrap Input, InputAddon, and InputClear inside InputGroup: borders and focus rings are managed by the outer container, clicking prefix text focuses the input, and the clear button appears automatically when there is content.
Clicking the prefix focuses the input; press Esc to clear.
import { Field, FieldLabel } from "@/components/ui/hacline/components/field";
import {
Input,
InputAddon,
InputClear,
InputGroup,
} from "@/components/ui/hacline/components/input";
import { XIcon } from "lucide-react";
export function WebsiteInput() {
return (
<Field name="website">
<FieldLabel>Project domain</FieldLabel>
<InputGroup>
<InputAddon>https://</InputAddon>
<Input defaultValue="hacline.dev" placeholder="example.com" />
<InputClear aria-label="Clear project domain">
<XIcon aria-hidden="true" />
</InputClear>
</InputGroup>
</Field>
);
}Input Filtering
Call details.cancel() inside onValueChange to block disallowed input while automatically restoring the previous value and caret position.
Invalid characters are blocked via `details.cancel()` without moving the cursor.
<Input
inputMode="numeric"
maxLength={6}
onValueChange={(value, details) => {
if (!/^\d*$/.test(value)) {
details.cancel();
}
}}
placeholder="Digits only"
/>Read-only & Disabled
<Input defaultValue="https://hacline.dev/docs" readOnly />
<Input defaultValue="Non-editable content" disabled />Props
Input
Prop
Type
Also inherits all native <input> HTML attributes and ref.
InputGroup
Prop
Type