Input
A themed single-line text input. Thin wrapper over the native input with tokenised styling, focus ring, and aria-invalid handling.
Install
Pull Input from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Input } from "@brika/clay";import { Input } from "@brika/clay/components/input";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { Input } from '@brika/clay/components/input';
/** Single-line text input in its default state. */
export default function InputDefaultDemo() {
return <Input placeholder="Type something…" />;
}Input, every way
Disabled
Disabled input, blocks interaction and reduces opacity.
File
File picker using the native file input type.
Invalid
Validation error state, set aria-invalid to trigger the destructive border.
Readonly
Read-only input, focusable but not editable, useful for copy-able values.
Types
Native input types, email, number, and search all pass through unchanged.
Accessibility
- Always pair with a
<Label>via matchingid/htmlFor, never rely onplaceholderas a label. -
aria-invalid="true"applies the destructive ring; pair with a visible error message linked viaaria-describedby. - Disabled inputs are removed from the tab order; use
readOnlywhen the content must stay focusable. - File inputs announce "Browse…" or similar on activation, ensure the label describes what to select.
Theme tokens
Every CSS variable Input reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Input
without touching component code.
Input tokens
24 tokens--input-containercolorvar(--background)components.input.containerInput background.
--input-labelcolorvar(--foreground)components.input.labelInput text color.
--input-bordercolorvar(--input)components.input.borderInput border color.
--input-placeholdercolorvar(--muted-foreground)components.input.placeholderInput placeholder text color.
--input-invalid-bordercolorvar(--destructive)components.input.invalidBorderBorder color drawn when the input is in an invalid state (`aria-invalid=true`).
--input-selection-containercolorvar(--primary)components.input.selectionContainerBackground color of selected text inside the input.
--input-selection-labelcolorvar(--primary-foreground)components.input.selectionLabelForeground color of selected text inside the input.
--input-file-labelcolorvar(--foreground)components.input.fileLabelForeground color of the inline file picker button rendered for `type="file"` inputs.
--input-radiusradiusvar(--radius-control)components.input.radiusInput corner radius.
--input-heightsize2.25remcomponents.input.heightDefault input height.
--input-padding-xsizecalc(var(--spacing) * 3)components.input.paddingXInline padding inside the input.
--input-padding-ysizecalc(var(--spacing) * 2)components.input.paddingYBlock padding inside the input.
--input-gapsizecalc(var(--spacing) * 2)components.input.gapGap between adjacent children inside the input.
--input-border-widthborder-width1pxcomponents.input.borderWidthBorder width on the input. Set non-zero for outline-style variants.
--input-border-styleborder-stylesolidcomponents.input.borderStyleBorder style on the input (`solid`, `dashed`, `double`, `none`).
--input-font-familyfont-familyvar(--font-sans)components.input.fontFamilyTypeface for input.
--input-font-sizefont-sizevar(--text-body-md)components.input.fontSizeFont size for input.
--input-font-weightfont-weight500components.input.fontWeightFont weight for input.
--input-line-heightline-height1.25components.input.lineHeightLine height for input.
--input-letter-spacingletter-spacing0components.input.letterSpacingLetter spacing for input. Useful for caps labels.
--input-text-transformtext-transformnonecomponents.input.textTransformText transform for input (`uppercase`, `lowercase`, `capitalize`, `none`).
--input-backdrop-blurblur0pxcomponents.input.backdropBlurBackdrop blur applied to the input surface. Set non-zero for a frosted-glass treatment.
--input-durationdurationvar(--motion-standard-duration)components.input.durationTransition duration for input state changes.
--input-easingeasingvar(--motion-standard-easing)components.input.easingTransition easing for input state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.input, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"input": {
"paddingX": "calc(var(--spacing) * 3)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-input-…) — see the
chips on each token row.
API reference
Props specific to Input. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
No wrapper-specific props, all attributes pass through to the underlying primitive.