Skip to content
GitHub (opens in a new tab)

Input

Single-line text entry for forms and filters. Optional start and end slots sit inside the field; a kit Button or Select can join its edge.

stableAtomcontracts/input.json

Preview

Input

Single-line text in lg, md, and sm. Field label sits on top or start (left). start and iconStart are prefix slots inside the control. action and affix join a kit Button or Select to the edge. No InputGroup cousin.

Master

Email with an icon and hint, a password error, and search with a shortcut chip. Medium size, label on top. Variants shows a start label, slots, actions and the large size.

We'll send receipts to this address.

Use at least 8 characters.

Usage

Wrap with Field. labelPosition top or start (left). start and iconStart are prefix slots inside the control, not the Field label.

Do's

  • Collecting short text such as name, email, or search queries
  • Inside a Field wrapper when label, hint, or error messaging is needed
  • A value people copy, like an invite link or API endpoint — action="copy"
  • A field with one short action of its own, like Apply on a promo code — action
  • A phone number with a country code — affix
  • Password entry where people may check what they typed — passwordToggle

Don'ts

  • One-time code or PIN — use InputOTP
  • Multi-line content — use Textarea
  • Choosing from fixed options — use Select or RadioGroup
  • Standalone labeled forms without Field — you must wire label association yourself
  • A money amount with a currency pick — use CurrencyInput beside Select, not affix
<Field label="Email" htmlFor="email" hint="We'll send receipts to this address.">
  <Input id="email" type="email" size="md" iconStart="Mail" placeholder="ada@example.com" />
</Field>

<Field label="Password" htmlFor="password" error="Use at least 8 characters.">
  <Input id="password" type="password" size="md" defaultValue="short" />
</Field>

<Field label="Search" htmlFor="search">
  <Input id="search" type="search" size="md" iconStart="Search" end="⌘K" placeholder="Invoices, customers, tasks" />
</Field>

When to use

  • Collecting short text such as name, email, or search queries
  • Inside a Field wrapper when label, hint, or error messaging is needed
  • A value people copy, like an invite link or API endpoint — action="copy"
  • A field with one short action of its own, like Apply on a promo code — action
  • A phone number with a country code — affix
  • Password entry where people may check what they typed — passwordToggle

When not to use

  • One-time code or PIN — use InputOTP
  • Multi-line content — use Textarea
  • Choosing from fixed options — use Select or RadioGroup
  • Standalone labeled forms without Field — you must wire label association yourself
  • A money amount with a currency pick — use CurrencyInput beside Select, not affix

What an agent reads

import { Input } from "agentic-ds-kit";
must
  • Must have associated label via Field or aria-label
  • error state should be described by Field error text
  • action Button is named by its visible label; "copy" swaps copy to copied and announces it in a polite live region
  • affix Select is named by its own ariaLabel; the Field label names the text input
  • describedBy goes on the text input only
  • passwordToggle: a button with a fixed name (showPassword), aria-pressed true while the value shows, and aria-controls on the input id
  • passwordToggle: a pointer press keeps focus and the caret in the field; keyboard focus stays on the toggle
  • Joined Button and Select are disabled with the Input
defaults
  • type text
  • size md
  • disabled false
  • error false
  • passwordToggle false
stops if
  • Do not invent local Input variants or InputGroup
  • Do not use raw hex in styles
  • Do not use start or end as the accessible name — wrap with Field label
  • Do not render a separate Lucide icon beside it — pass a Lucide name or component to the icon props
  • Do not place a Button or Select next to an Input by hand to look joined — use action or affix
  • Do not use action as the form's submit button
  • Do not use affix for currency — use CurrencyInput beside Select
  • Do not add your own eye button for passwords — set passwordToggle

From contracts/input.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
describedBystringNo—Id(s) for aria-describedby on the input. Field passes its hint or error id.
idstringYes——
typetext | email | password | searchNotext—
sizelg | md | smNomd—
placeholderstringNo——
disabledbooleanNofalse—
errorbooleanNofalse—
defaultValuestringNo——
namestringNo——
startstringNo—Prefix text inside the field on the left. Not a label.
endstringNo—Suffix text inside the field on the right. Not a label.
iconStartKitIconNo—Left icon. A curated Lucide name (PascalCase or kebab-case) renders instantly; any other Lucide name needs import "agentic-ds-kit/icons-on-demand" once (otherwise it is skipped with a dev warning). Or pass the Lucide component (Plus) or an element.
iconEndKitIconNo—Right icon. A curated Lucide name (PascalCase or kebab-case) renders instantly; any other Lucide name needs import "agentic-ds-kit/icons-on-demand" once (otherwise it is skipped with a dev warning). Or pass the Lucide component (Plus) or an element.
demohover | focusNo—playground only
valuestringNo—controlled. When set, do not also rely on defaultValue.
onChangefunctionNo—(value: string) => void
ariaLabelstringNo—When there is no Field label, such as search inside DropdownMenu.
action"copy" | InputActionButtonNo—Kit Button joined to the end edge, the same size as the Input, appearance outline mode neutral. "copy" copies the value and shows the copied label for a moment, with a polite live region. Or { label, icon?, onClick, loading? }: label is the visible words and the name. Not the form's submit.
affixInputAffixNo—Kit Select joined to one side: { side: "start" | "end", ariaLabel, options, value?, defaultValue?, onChange?, name? }. Its id is {id}-affix and ariaLabel names it (Country code). For phone and country codes only. When action is set too, an end affix is skipped.
passwordTogglebooleanNofalsetype=password only. An eye button inside the field shows or hides the value. Named by KitLabels showPassword with aria-pressed. Takes the iconEnd slot.
  • Component
    →

    InputOTP

    One-time code / PIN as separate slots.

  • Component
    →

    Textarea

    Multi-line text entry for notes and descriptions.

  • Component
    →

    Select

    Choose one or several options from a list.

  • Component
    →

    RadioGroup

    Choose exactly one option from a small visible set.