Input

Input is a thin native control for short text-like values; Field owns labels, descriptions, and validation messages.

Overview and decision boundary

Use Input for short text values such as names, filters, URLs, and settings.

Do not use placeholder text as the only label.

A label and description remain outside the native Input.

import { Input, Label } from "@nerio-ui/ui";<Label htmlFor="project-name">Project name</Label><Input id="project-name" placeholder="Launch materials" autoComplete="organization" required />

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add inputimport { Field, Input } from '@nerio-ui/ui';

Usage

import { Field, Input } from '@nerio-ui/ui';<Field label="Project name" description="Use a short recognizable name."><Input placeholder="Launch materials" required autoComplete="organization" /></Field>

Variants

VariantPurpose
sm / md / lgShared density-aware control sizes; md is the default.
Native typesText, email, password, search, tel, url, and number semantics.

Anatomy

SlotPurpose
inputInput slot exposed through data-slot="input".

States

StateBehavior
DefaultAccepts editable text-like values through native input behavior.
InvalidExposes aria-invalid and the danger border token without owning validation.
Read-onlyKeeps the value focusable and selectable without accepting edits.
DisabledRemoves the control from interaction and applies disabled tokens.

Motion

  • Hover transitions the border color through shared motion tokens.
  • Focus-visible animates the ring and border only.
  • Reduced motion keeps the state change but removes nonessential timing.

Accessibility

  • Use with Label or Field so the control has an accessible name.
  • Supports native input attributes including required, disabled, autocomplete, and aria-describedby.
  • Invalid state normalizes to aria-invalid=true only for true validation errors.
  • Disabled state uses the native disabled attribute; read-only stays focusable and selectable.
  • Supported types are text, email, password, search, tel, url, and number.

API

PropValuesPurpose
sizesm | md | lgSelects the density-aware control height.
htmlSizenumberForwards the native input size attribute.
typeSupported native typePreserves native keyboard and form semantics.
invalidbooleanExposes the invalid state for Field and FormMessage composition.
classNamestringExtends the root without replacing component tokens.

Implementation contract

ContractValue
Registry iteminput installs 6 source files.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Input for short values; use Textarea for longer notes.
  • Prefer Field when the control needs label, description, or validation message.

Do / do not

Do

Use autocomplete and inputMode intentionally, and compose labels and messages outside the native Input.

Do not

Add prefix, suffix, search results, or validation behavior directly to Input; use InputGroup or a dedicated control.

Tokens

TokenGroupControls
--n-input-height-smSizingSmall control height.
--n-input-height-mdSizingDefault control height.
--n-input-height-lgSizingLarge control height.
--n-input-radiusShapeControl corner radius.
--n-input-backgroundSurfaceDefault control surface.
--n-input-foregroundSurfaceDefault input text.
--n-input-borderBorderDefault border.
--n-input-border-hoverBorderHover border.
--n-input-border-focusBorderFocused border.
--n-input-border-dangerInvalidInvalid border treatment.
--n-motion-focus-durationFocusFocus transition duration.
--n-focus-ringFocusVisible focus treatment.