Skip to content
nexubDesign System
v12.7.0

Components · Form & Input

Input

StableAdded v0.0.1

Text input field for forms. Supports size variants, icons, addons, and validation states.

import { Input } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Capturing short free-form text (name, email, search term)

  • Single-line data entry within a form

  • Filtering or searching a list of items

  • Inline editing of a single value

Use something else for
  • Multi-line text — use Textarea instead

  • Choosing from a fixed list of options — use Select or Combobox

  • Numeric stepping — use NumberInput for increment/decrement control

  • Passwords — use PasswordInput which toggles visibility

Playground

Playground

Live
TSX
<Input size="md" placeholder="Enter value…" />

Examples

Default

Sizes

Invalid state

With label and helper

We'll never share your email.

States

  • default
  • disabled
  • invalid
  • loading
  • size="sm"
  • size="md"
  • size="lg"

Props

Props
PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Control height and font size.
invalidboolean—Applies error ring styling.
disabledbooleanfalseDisables the input.
placeholderstring—Placeholder text.
typestring'text'HTML input type attribute.
leadingIconReact.ReactNode—Icon rendered at the start of the input.
trailingIconReact.ReactNode—Icon rendered at the end of the input.
leadingAddonstring—Text addon rendered before the input (e.g. "https://").
trailingAddonstring—Text addon rendered after the input (e.g. ".com").
clearableboolean—Shows a clear button while there is a value. Clearing fires onChange with "".
loadingboolean—Spinner in the trailing slot and aria-busy on the input.
showCountboolean—Shows a "12/80" counter; needs maxLength. Announced politely near the limit.
wrapperClassNamestring—

Design tokens

Input reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Input below it, and leave the roles other components share alone. See the three token tiers.

Input, Textarea, Select and Combobox triggers.

Input design tokens
TokenAliasesNotes
--field-bg--color-surface-container-lowest—
--field-fg--color-on-surface—
--field-border--color-outline—
--field-radius--shape-field—
CSS
/* One area of your app */
.checkout {
  --field-bg: var(--color-secondary);
}

Accessibility

ARIA roles

textbox

Keyboard

  • Tab

    Moves focus to the input.

  • Esc

    Browsers may revert recent changes (autofill suggestions).

Focus

  • Visible focus ring on `:focus-visible`. Pair with a `<Label htmlFor>` so clicking the label moves focus into the field.

Screen reader

  • `invalid` toggles `aria-invalid="true"` so AT users hear the error state.

  • Use `aria-describedby` to associate `HelperText` or error messages.