You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -10,7 +11,7 @@ TextInput is a form component to add default styling to the native text input.
10
11
11
12
**Note:** Don't forget to set `aria-label` to make the TextInput accessible to screen reader users.
12
13
13
-
## Default example
14
+
## Examples
14
15
15
16
```jsx live
16
17
<>
@@ -29,38 +30,69 @@ TextInput is a form component to add default styling to the native text input.
29
30
</>
30
31
```
31
32
32
-
## Component props
33
+
## Props
33
34
34
-
Native `<input>` attributes are forwarded to the underlying React `input` component and are not listed below.
35
+
### TextInput
35
36
36
37
<PropsTable>
37
-
<PropsTable.Rowname="aria-label"requiredtype="string"description="Allows input to be accessible." />
38
-
<PropsTable.Rowname="block"type="boolean"description="Adds `display: block` to element" />
39
-
<PropsTable.Rowname="contrast"type="boolean"description="Changes background color to a higher contrast color" />
38
+
<PropsTable.Rowname="aria-label"type="string"description="Allows input to be accessible." />
39
+
<PropsTable.Row
40
+
name="block"
41
+
type="boolean"
42
+
defaultValue="false"
43
+
description={
44
+
<>
45
+
Adds <InlineCode>display: block</InlineCode> to element
46
+
</>
47
+
}
48
+
/>
49
+
<PropsTable.Row
50
+
name="contrast"
51
+
type="boolean"
52
+
defaultValue="false"
53
+
description="Changes background color to a higher contrast color"
54
+
/>
40
55
<PropsTable.Row
41
56
name="variant"
42
-
type="string"
43
-
description="Can be either `small` or `large`. Creates a smaller or larger input than the default."
57
+
type="'small' | 'large'"
58
+
description="Creates a smaller or larger input than the default."
59
+
/>
60
+
<PropsTable.Row
61
+
name="width"
62
+
type={
63
+
<>
64
+
string | number | <Linkhref="https://styled-system.com/guides/array-props">Array<string | number></Link>
65
+
</>
66
+
}
67
+
description="Set the width of the input"
68
+
/>
69
+
<PropsTable.Row
70
+
name="maxWidth"
71
+
type={
72
+
<>
73
+
string | number | <Linkhref="https://styled-system.com/guides/array-props">Array<string | number></Link>
74
+
</>
75
+
}
76
+
description="Set the maximum width of the input"
77
+
/>
78
+
<PropsTable.Row
79
+
name="minWidth"
80
+
type={
81
+
<>
82
+
string | number | <Linkhref="https://styled-system.com/guides/array-props">Array<string | number></Link>
83
+
</>
84
+
}
85
+
description="Set the minimum width of the input"
44
86
/>
45
-
<PropsTable.Rowname="width"type="string | number"description="Set the width of the input" />
46
-
<PropsTable.Rowname="maxWidth"description="Set the maximum width of the input">
47
-
<PropsTable.Row.Type>
48
-
string | number | <Linkhref="https://styled-system.com/guides/array-props">Array</Link>
49
-
</PropsTable.Row.Type>
50
-
</PropsTable.Row>
51
-
<PropsTable.Rowname="minWidth"description="Set the minimum width of the input">
52
-
<PropsTable.Row.Type>
53
-
string | number | <Linkhref="https://styled-system.com/guides/array-props">Array</Link>
54
-
</PropsTable.Row.Type>
55
-
</PropsTable.Row>
56
87
<PropsTable.Row
57
88
name="icon"
58
-
type="ReactNode"
59
-
description="An Octicon react component. To be used inside of input. Positioned on the left edge."
89
+
type="React.ComponentType"
90
+
description="An Octicon React component. To be used inside of input. Positioned on the left edge."
60
91
/>
61
92
<PropsTable.SxRow />
62
93
<PropsTable.RefRow
63
94
elementType="input"
95
+
refType="HTMLInputElement"
64
96
description="A ref to the input element rendered by this component. Note: this is not the outermost element rendered by TextInput. There is also a div wrapper for which a ref is not accepted."
65
97
/>
66
98
<PropsTable.PassthroughPropsRow
@@ -70,3 +102,24 @@ Native `<input>` attributes are forwarded to the underlying React `input` compon
0 commit comments