# Input

A native text input styled for Zenos fields and groups.

A native text input styled for Zenos fields and groups.

```tsx
import { Input, Stack } from "@zentara-co/zenos-ui";

function InputPreviewExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Input placeholder="Search workspace" />
      <Input variant="filled" defaultValue="security@example.com" />
    </Stack>
  );
}
```

```tsx
import { Input } from "@zentara-co/zenos-ui";
```

## Sizes

Inputs use the shared Zenos `sm`, `md`, and `lg` control scale.

```tsx
import { Input, Stack } from "@zentara-co/zenos-ui";

function InputSizesExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Input size="sm" placeholder="Small" />
      <Input size="md" placeholder="Medium" />
      <Input size="lg" placeholder="Large" />
    </Stack>
  );
}
```

## Variants

Choose a surface that matches the field hierarchy. `default` is the standard bordered control, `filled` is the subtle filled surface, and `none` is borderless for inline editing.

```tsx
import { Input, Stack } from "@zentara-co/zenos-ui";

type CatalogVariantProps = { limit?: number };

const limited = <T,>(items: readonly T[], limit?: number) =>
  limit === undefined ? items : items.slice(0, limit);

const formControlSurfaceVariants = ["default", "filled", "none"] as const;

const inputVariants = formControlSurfaceVariants;

function InputVariantsExample({ limit }: CatalogVariantProps = {}) {
  if (limit !== undefined) {
    return (
      <Stack gap="3" className="w-full max-w-sm">
        {limited(inputVariants, limit).map((variant) => (
          <Input key={variant} variant={variant} placeholder={variant} />
        ))}
      </Stack>
    );
  }

  return (
    <Stack gap="3" className="w-full max-w-sm">
      {inputVariants.map((variant) => (
        <Input
          key={variant}
          variant={variant}
          defaultValue={variant === "none" ? undefined : "Value"}
          placeholder="Placeholder"
        />
      ))}
    </Stack>
  );
}
```

## States

Hover, focus, filled, invalid, and disabled treatments follow the design-system input spec. Invalid controls use a 2px danger-subtle border and accent red subtlest fill in light and dark (the `none` variant stays borderless). Set `aria-invalid` directly or compose with `Field.Root invalid` so assistive technology receives the error relationship.

```tsx
import { Input, Stack } from "@zentara-co/zenos-ui";

function InputStatesExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Input placeholder="Placeholder" />
      <Input defaultValue="Value" />
      <Input aria-invalid defaultValue="Value" />
      <Input disabled placeholder="Placeholder" />
    </Stack>
  );
}
```

## With Field

```tsx
import { Field, Input } from "@zentara-co/zenos-ui";

<Field.Root required>
  <Field.Label>Email</Field.Label>
  <Field.Control render={<Input type="email" autoComplete="email" />} />
  <Field.Description>Used for security notifications.</Field.Description>
</Field.Root>;
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| size | 'sm' \| 'md' \| 'lg' | md | Control size. |
| variant | 'default' \| 'filled' \| 'none' | default | Surface treatment (`default` = standard, `filled` = subtle, `none` = borderless). |
| aria-invalid | boolean \| 'grammar' \| 'spelling' | — | Native invalid state. Field.Root supplies it when its invalid prop is set. |

All applicable native input props, events, ARIA attributes, styles, data attributes, and refs are preserved.

## Accessibility

Input preserves native input semantics. Provide a visible label with `Field.Label` or `Label`; use an accessible name directly only when the visual context already communicates the purpose. Prefer `Field.Root invalid` to connect an error message instead of relying on color alone.

Source: https://zenos-ui.pages.dev/components/input/