Skip to content
Statix Design System

Forms

Input

Single-line text field. It is 44px high with 16px corners and a white fill, so it reads as a field on both the page background and inside cards.

import { Input } from '@statix/ui/input';

Playground

Controls
<Input placeholder="yoga-berger.de" />

Examples

With a label

Pair every input with a visible Label. Use Field when you also need a description or an error.

<script lang="ts">
	import { Input } from '@statix/ui/input';
	import { Label } from '@statix/ui/label';
</script>

<div class="flex w-full max-w-sm flex-col gap-2">
	<Label for="input-email">Email</Label>
	<Input id="input-email" type="email" autocomplete="email" placeholder="anna@yoga-berger.de" />
</div>

Sizes

sm (36px), md (44px, default) and lg (52px).

<script lang="ts">
	import { Input } from '@statix/ui/input';
</script>

<div class="flex w-full max-w-sm flex-col gap-3">
	<Input size="sm" aria-label="Small" placeholder="Small, 36px" />
	<Input size="md" aria-label="Medium" placeholder="Medium, 44px (default)" />
	<Input size="lg" aria-label="Large" placeholder="Large, 52px" />
</div>

Pill

The pill variant is for search fields and single-field forms. Use InputGroup when the field needs an icon or a button.

<script lang="ts">
	import { Input } from '@statix/ui/input';
</script>

<div class="w-full max-w-md">
	<Input
		variant="pill"
		size="lg"
		type="search"
		aria-label="Search help articles"
		placeholder="Search help articles, e.g. restore backup"
	/>
</div>

Invalid

Set aria-invalid and the border turns red. Point aria-describedby at the message that explains the problem.

This number looks too short. Enter it with the area code.

<script lang="ts">
	import { Input } from '@statix/ui/input';
	import { Label } from '@statix/ui/label';
</script>

<div class="flex w-full max-w-sm flex-col gap-2">
	<Label for="input-phone">Phone</Label>
	<Input
		id="input-phone"
		type="tel"
		value="040 468"
		aria-invalid="true"
		aria-describedby="input-phone-error"
	/>
	<p id="input-phone-error" class="text-small text-destructive">
		This number looks too short. Enter it with the area code.
	</p>
</div>

Disabled

The field turns grey and ignores input. Say why next to it.

Your customer number can't be changed. Call Jonas Weber on 040 468 970 790 if it is wrong.

<script lang="ts">
	import { Input } from '@statix/ui/input';
	import { Label } from '@statix/ui/label';
</script>

<div class="flex w-full max-w-sm flex-col gap-2">
	<Label for="input-customer">Customer number</Label>
	<Input id="input-customer" value="SX-10482" disabled />
	<p class="text-small text-muted-foreground">
		Your customer number can't be changed. Call Jonas Weber on 040 468 970 790 if it is wrong.
	</p>
</div>

File

type="file" binds the chosen files with bind:files.

PNG or SVG, up to 2 MB.

<script lang="ts">
	import { Input } from '@statix/ui/input';
	import { Label } from '@statix/ui/label';

	let files = $state<FileList | null>(null);
</script>

<div class="flex w-full max-w-sm flex-col gap-2">
	<Label for="input-logo">Logo for your invoices</Label>
	<Input id="input-logo" type="file" accept="image/png,image/svg+xml" bind:files />
	<p class="text-small text-muted-foreground">
		{files?.length ? files[0].name : 'PNG or SVG, up to 2 MB.'}
	</p>
</div>

Guidelines

Do

  • Give every input a visible label above it. Placeholders disappear as soon as people type.
  • Use the matching type and autocomplete (email, tel, name) so phones show the right keyboard and browsers can fill it in.
  • Write error messages that say how to fix the value: "Enter the number with the area code".

Don't

  • Don't use the placeholder as the label.
  • Don't use the pill variant inside dense settings forms. Keep it for search.
  • Don't disable a field without saying why.

Accessibility

  • Renders a native <input>, so typing, selection and autofill work as usual.
  • Label it with <Label for> or aria-label. A placeholder is not a label.
  • aria-invalid="true" switches to the error style. Link the message with aria-describedby so screen readers read it.
  • The focus ring is 3px of --ring at 40% plus a primary border, visible on both background colours.

API reference

Input

renders <input> and accepts its attributes
PropTypeDefault
variant 'default' | 'pill'

default has 16px corners. pill is fully rounded, for search.

'default'
size 'sm' | 'md' | 'lg'

Height: 36, 44 or 52px. default is an alias of md. Replaces the numeric HTML size attribute.

'md'
type HTMLInputTypeAttribute

Any input type. With "file", bind:files holds the selection.

'text'
value bindany

The current value.

–
files bindFileList | null

Selected files when type is "file".

–
ref bindHTMLInputElement | null

The rendered element.

–
class ClassValue

Merged with the variant classes; yours win.

–
Data attributeMeaning
data-slot="input"Present unless you pass another data-slot. InputGroup sets "input-group-control".
data-variantThe current variant.

inputVariants

The tailwind-variants function behind Input. Use it to style other elements like a field.