antlitz
Menu

Input

A single-line text field. Renders a native input, so every type, validation attribute, and form behaviour comes from the platform.

import { Input } from "antlitz";

API

PropTypeDefault
radius"none" | "sm" | "md" | "lg" | "full"none
size"sm" | "md" | "lg"md
variant"outline" | "soft" | "plain"outline

size is antlitz's own prop, not the native size attribute — the native one is removed from the type to avoid the collision.

Variants

export function Variants() {
  return (
    <>
      <Input placeholder="Outline" />
      <Input variant="soft" placeholder="Soft" />
      <Input variant="plain" placeholder="Plain" />
    </>
  );
}

Sizes

export function Sizes() {
  return (
    <>
      <Input size="sm" placeholder="Small" />
      <Input size="md" placeholder="Medium" />
      <Input size="lg" placeholder="Large" />
    </>
  );
}

Every size holds the same height at both breakpoints. Mobile uses text-base to stop iOS zooming on focus and text-sm from md upwards, with padding adjusted so the box does not change height.

Radius

export function Radius() {
  return RADII.map((radius) => (
    <Input key={radius} radius={radius} placeholder={radius} />
  ));
}

States

export function States() {
  return (
    <>
      <Input disabled placeholder="Disabled" />
      <Input readOnly defaultValue="Read-only" />
      <Input aria-invalid defaultValue="Invalid" />
      <Input variant="soft" aria-invalid defaultValue="Invalid soft" />
    </>
  );
}

aria-invalid colours the border and the focus ring with the danger token. Set it on the control, or let Field set it by passing an error.

Types

export function Types() {
  return (
    <>
      <Input type="email" placeholder="you@example.com" />
      <Input type="password" defaultValue="password" />
      <Input type="search" placeholder="Search" />
      <Input type="file" />
      <Input type="date" />
      <Input type="number" defaultValue="42" />
    </>
  );
}

type="file" styles the file-selector button; type="search" suppresses the browser's default clear affordance, which does not follow the design system.

Composition

export function Composition() {
  return (
    <div className="flex w-full max-w-md items-start gap-2">
      <Input type="search" placeholder="Search" />
      <Button>Search</Button>
    </div>
  );
}