Text input

One line of text, with room at either end for a mark or an affix. The plainest field in the library, and the one the others are shaped like.

(Optional)
This is a hint text to help users.
<Input
  size="md"
  label="Last name"
  required
  optional
  info="We only use this on your invoices."
  leading={<UserIcon />}
  trailing={<SearchIcon size={20} />}
  hint="This is a hint text to help users."
/>

Slots

Four, and the pairing is deliberate. leading and trailing take a mark: an icon, a spinner, a button. prefix and suffix take text that is read as part of the value: a currency symbol, a protocol, a unit. They are separate props because the design spaces them differently. An affix sits 12px in from the edge with 14px to the value, because it belongs to the value rather than sitting beside it.

billing-form.tsx
import { Input } from 'yote-ui'

<Input label="Website" prefix="https://" placeholder="billia.io" />
<Input label="Amount" prefix="$" suffix="USD" />
<Input label="Search" leading={<SearchIcon />} />

Nothing is rendered for a slot you leave unset, so the field collapses to a plain box with no stray padding. The gap belongs to the slot, not to the field.

Sizes

Only sm is drawn in Figma. The other two follow the ramp the password field already set, so a form mixing fields lines up rather than each component inventing its own scale.

sizeRadiusPaddingNotes
sm8px8pxFigma 6:508. The only measured one.
md12px10pxThe default.
lg12px12px

Props

PropTypeDefaultNotes
leadingReactNodeA mark at the start of the field. 20px in the frame.
trailingReactNodeA mark at the end. Also where an inline selector goes.
prefixReactNodeText at the start, inside the field.
suffixReactNodeText at the end, inside the field.
requiredbooleanfalseRenders the asterisk and sets aria-required.
optionalbooleanfalseRenders the muted "(Optional)" note.
infostringInfo marker beside the label, with this as its tooltip.

Shared

PropTypeDefaultNotes
valuestringControlled value.
defaultValuestringInitial value when uncontrolled.
onChange(value: string) => voidReceives the value, never the event.
labelReactNodeRendered as a real <label> wired by htmlFor.
hintReactNodeHelper text under the field.
errorReactNodeError text. Implies invalid unless invalid says otherwise.
invalidbooleanForces the error styling on or off.
errorKeystring | numberChange it to replay the error animation.
disabledbooleanfalseGreys the field out.
readOnlybooleanfalseReads as filled, stays focusable.
size'sm' | 'md' | 'lg''md'Size scale, where the component defines one.
classNamesRecord<Part, string>Per-part class names.