1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: Input
summary: >-
A bordered text input, styled to match Select exactly. Usually wrapped in
Field for its label and hint.
---
## Basic
`<input>` is the component — styled bare, no class. Nothing else on this
site uses a text input, so there is nothing for the selector to clash with.
<figure class="example">
<figcaption>Input</figcaption>
<div>
<input type="text" placeholder="Dishwasher manual" style="max-width: 20rem;" />
</div>
<details open><summary>Markup</summary>
<pre><code><input type="text" placeholder="Dishwasher manual" style="max-width: 20rem;" /></code></pre>
</details>
</figure>
## Focus and disabled
<figure class="example">
<figcaption>States</figcaption>
<div data-layout="stack">
<input type="text" value="Focused" autofocus style="max-width: 20rem;" />
<input type="text" value="Disabled" disabled="" style="max-width: 20rem;" />
</div>
<details><summary>Markup</summary>
<pre><code><input type="text" value="Focused" autofocus style="max-width: 20rem;" />
<input type="text" value="Disabled" disabled="" style="max-width: 20rem;" /></code></pre>
</details>
</figure>
## Invalid
Invalid state is expressed on the control itself, so it works with native
form validation, plus an error line below. `role="alert"` is a real
live-region role for validation text, so it doubles as the selector that
turns a `<small>` hint red.
<figure class="example">
<figcaption>Invalid</figcaption>
<div>
<label class="field" style="max-width: 20rem;">
Accent hex
<input type="text" value="not-a-color" aria-invalid="true" />
<small role="alert">Not a valid hex color.</small>
</label>
</div>
<details><summary>Markup</summary>
<pre><code><label class="field" style="max-width: 20rem;">
Accent hex
<input type="text" value="not-a-color" aria-invalid="true" />
<small role="alert">Not a valid hex color.</small>
</label></code></pre>
</details>
</figure>
## API
<table>
<thead><tr><th scope="col">Element / attribute</th><th scope="col">Values</th><th scope="col">Notes</th></tr></thead>
<tbody>
<tr><td><code>input</code></td><td></td><td>Required base — no class.</td></tr>
<tr><td><code>type</code></td><td>string</td><td>Any native input type except <code>checkbox</code>/<code>radio</code>, which are their own components.</td></tr>
<tr><td><code>placeholder</code></td><td>string</td><td></td></tr>
<tr><td><code>disabled</code></td><td>boolean</td><td></td></tr>
<tr><td><code>aria-invalid</code></td><td><code>"true"</code></td><td>Reddens the border and fill.</td></tr>
</tbody>
</table>