FormsInput
Searchastronomic.dev# Input
For a single line of text in a form, like a name or an email address.
Static: no JavaScript.
## Usage
```astro
import Input from "@astronomic-dev/ui/components/Input.astro";
```
## Examples
### Text and disabled
```astro
---
import Field from "@astronomic-dev/ui/components/Field.astro";
import Input from "@astronomic-dev/ui/components/Input.astro";
import { describedBy } from "@astronomic-dev/ui/lib/field.ts";
---
<div class="grid max-w-md gap-5">
<Field label="Email" for="input-email">
<Input id="input-email" name="email" type="email" autocomplete="email" placeholder="name@example.com" />
</Field>
<Field label="Company" for="input-company" hint="Not needed for private clients.">
<Input id="input-company" name="company" disabled value="Northwind" aria-describedby={describedBy("input-company", { hint: true })} />
</Field>
</div>
```
## Props
### Input
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `invalid` | `boolean` | `false` | Marks the value as wrong (aria-invalid) and shows the danger border. |
| `class` | `string` | None | More classes, merged with cn(), so yours win on conflicts. |
Any other attribute goes on the <input>. type is "text" unless you set it.
## Accessibility
- Renders a native <input>, type text by default.
- It has no label of its own: put it in a Field, or give it an aria-label.
- invalid sets aria-invalid="true" and the danger border.
Input
FreeFor a single line of text in a form, like a name or an email address.
- File
- Input.astro
- Group
- Forms
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Text and disabled
Not needed for private clients.
Force statemain.astro
examples/input/main.astro
---
import Field from "@astronomic-dev/ui/components/Field.astro";
import Input from "@astronomic-dev/ui/components/Input.astro";
import { describedBy } from "@astronomic-dev/ui/lib/field.ts";
---
<div class="grid max-w-md gap-5">
<Field label="Email" for="input-email">
<Input id="input-email" name="email" type="email" autocomplete="email" placeholder="name@example.com" />
</Field>
<Field label="Company" for="input-company" hint="Not needed for private clients.">
<Input id="input-company" name="company" disabled value="Northwind" aria-describedby={describedBy("input-company", { hint: true })} />
</Field>
</div>Minimal · Light