|
1
|
import { ComponentExample } from "@/components/ComponentExample" |
|
2
|
import { ComponentReference } from "@/components/ComponentReference" |
|
3
|
|
|
4
|
export const metadata = { |
|
5
|
title: `Input`, |
|
6
|
} |
|
7
|
|
|
8
|
# {metadata.title} |
|
9
|
|
|
10
|
A component that renders a form input field using Medusa's design system. |
|
11
|
|
|
12
|
In this guide, you'll learn how to use the Input component. |
|
13
|
|
|
14
|
<ComponentExample name="input-demo" /> |
|
15
|
|
|
16
|
## Usage |
|
17
|
|
|
18
|
```tsx |
|
19
|
import { Input } from "@medusajs/ui" |
|
20
|
``` |
|
21
|
|
|
22
|
```tsx |
|
23
|
<Input placeholder="Placeholder" id="input-id" /> |
|
24
|
``` |
|
25
|
|
|
26
|
--- |
|
27
|
|
|
28
|
## API Reference |
|
29
|
|
|
30
|
<ComponentReference mainComponent="Input" /> |
|
31
|
|
|
32
|
--- |
|
33
|
|
|
34
|
## Examples |
|
35
|
|
|
36
|
### Password |
|
37
|
|
|
38
|
<ComponentExample name="input-password" /> |
|
39
|
|
|
40
|
### Search |
|
41
|
|
|
42
|
<ComponentExample name="input-search" /> |
|
43
|
|
|
44
|
### Disabled |
|
45
|
|
|
46
|
<ComponentExample name="input-disabled" /> |
|
47
|
|
|
48
|
### Small Size |
|
49
|
|
|
50
|
<ComponentExample name="input-small" /> |
|
51
|
|
|
52
|
### Controlled |
|
53
|
|
|
54
|
<ComponentExample name="input-controlled" /> |
|
55
|
|
|
56
|
### Error State |
|
57
|
|
|
58
|
You can leverage the native `aria-invalid` property to show an error state on your input: |
|
59
|
|
|
60
|
<ComponentExample name="input-error" hideFeedback /> |