Input
Data inputA text input (type text, email, number, password, search, date, file …) with bind:value, or bind:files for type="file". Inside a Field it takes its id, label, description, error and invalid and disabled state from the Field.
import { Input } from '@limerdev/zest'; Use for
Single-line text and number entry, in a
Field. Don't
An Input without a label: wrap it in a
Field with a Field.Label, or give it aria-label. type="checkbox" or type="radio". Multi-line text.Examples
Types
Any text-like type. Outside a Field, name it with aria-label or a Label.
<script lang="ts">
import { Input } from '@limerdev/zest';
</script>
<div class="grid w-full max-w-sm gap-3">
<Input aria-label="Search orders" type="search" placeholder="Search orders…" />
<Input aria-label="Email" type="email" placeholder="name@limer.se" />
<Input aria-label="Hours" type="number" min="0" step="0.5" value="7.5" />
<Input aria-label="Date" type="date" />
<Input aria-label="Attachment" type="file" />
</div> States
aria-invalid marks an input invalid; inside a Field, a Field.Error does it for you.
<script lang="ts">
import { Input } from '@limerdev/zest';
</script>
<div class="grid w-full max-w-sm gap-3">
<Input aria-label="Invalid email" aria-invalid="true" value="not an email" />
<Input aria-label="Read-only" disabled value="Can't change this" />
</div> Props
Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that
renders your own element, with props to spread on it).
Input
| Prop | Type | Default | Description |
|---|---|---|---|
| files bindable | FileList | null | – | The chosen files, for type="file". Bindable. |
| value bindable | string | number | null | – | The text, or a number for type="number". Bindable. |