aidos-ui 3.0.31 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/.claude/settings.local.json +14 -1
  2. package/CLAUDE.md +72 -0
  3. package/README.md +43 -29
  4. package/dist/Badge.d.ts +2 -2
  5. package/dist/Badge.js.map +1 -1
  6. package/dist/BaseButton.d.ts +2 -2
  7. package/dist/BaseButton.js +2 -2
  8. package/dist/BaseButton.js.map +1 -1
  9. package/dist/BaseInput.d.ts +2 -2
  10. package/dist/BaseInput.js.map +1 -1
  11. package/dist/BaseLink.d.ts +2 -2
  12. package/dist/BaseLink.js +2 -2
  13. package/dist/BaseLink.js.map +1 -1
  14. package/dist/BaseListItem.d.ts +3 -3
  15. package/dist/BaseListItem.js.map +1 -1
  16. package/dist/BaseView.d.ts +2 -2
  17. package/dist/BaseView.js.map +1 -1
  18. package/dist/Calendar.d.ts +4 -4
  19. package/dist/DarkMode.js.map +1 -1
  20. package/dist/DateInput.d.ts +2 -2
  21. package/dist/DatePicker.js.map +1 -1
  22. package/dist/DatetimeInput.d.ts +2 -2
  23. package/dist/Dialog.d.ts +3 -3
  24. package/dist/Dialog.js.map +1 -1
  25. package/dist/Dropdown.d.ts +3 -3
  26. package/dist/Dropdown.js.map +1 -1
  27. package/dist/Icon.d.ts +3 -3
  28. package/dist/Icon.js +2 -21
  29. package/dist/Icon.js.map +1 -1
  30. package/dist/IconLink.js +2 -1
  31. package/dist/IconLink.js.map +1 -1
  32. package/dist/Interactable.d.ts +4 -4
  33. package/dist/Interactable.js +2 -2
  34. package/dist/Interactable.js.map +1 -1
  35. package/dist/ListButtonItem.js +2 -2
  36. package/dist/ListButtonItem.js.map +1 -1
  37. package/dist/ListLinkItem.js +2 -2
  38. package/dist/ListLinkItem.js.map +1 -1
  39. package/dist/MenuIcon.js.map +1 -1
  40. package/dist/NextJSRouter.js.map +1 -1
  41. package/dist/NextJSRouterState.js.map +1 -1
  42. package/dist/OnVisible.d.ts +1 -1
  43. package/dist/OnVisible.js.map +1 -1
  44. package/dist/Popover.d.ts +7 -7
  45. package/dist/Popover.js +2 -2
  46. package/dist/Popover.js.map +1 -1
  47. package/dist/ProgressBar.d.ts +2 -2
  48. package/dist/ProgressBar.js.map +1 -1
  49. package/dist/Providers.d.ts +2 -2
  50. package/dist/Providers.js +2 -2
  51. package/dist/Providers.js.map +1 -1
  52. package/dist/RangeInput.d.ts +3 -3
  53. package/dist/RangeInput.js +2 -2
  54. package/dist/RangeInput.js.map +1 -1
  55. package/dist/RootView.js.map +1 -1
  56. package/dist/Select.d.ts +2 -3
  57. package/dist/Select.js.map +1 -1
  58. package/dist/StaticCheckbox.js.map +1 -1
  59. package/dist/Storage.d.ts +2 -1
  60. package/dist/Storage.js.map +1 -1
  61. package/dist/Stream.js.map +1 -1
  62. package/dist/Sublist.d.ts +2 -2
  63. package/dist/Tabs.d.ts +4 -4
  64. package/dist/Tabs.js +2 -4
  65. package/dist/Tabs.js.map +1 -1
  66. package/dist/Text.d.ts +2 -2
  67. package/dist/Text.js.map +1 -1
  68. package/dist/TextArea.d.ts +2 -2
  69. package/dist/TextArea.js.map +1 -1
  70. package/dist/TextInput.d.ts +4 -3
  71. package/dist/TextInput.js +14 -5
  72. package/dist/TextInput.js.map +1 -1
  73. package/dist/TextPairing.d.ts +2 -2
  74. package/dist/TextPairing.js.map +1 -1
  75. package/dist/Tooltip.d.ts +4 -4
  76. package/dist/Tooltip.js.map +1 -1
  77. package/dist/aria.js.map +1 -1
  78. package/dist/hash.js.map +1 -1
  79. package/dist/jss.d.ts +21 -21
  80. package/dist/jss.js +6 -6
  81. package/dist/jss.js.map +1 -1
  82. package/dist/numberToBase.js.map +1 -1
  83. package/dist/stateMachineContextFactory.js.map +1 -1
  84. package/dist/useCookie.js.map +1 -1
  85. package/dist/useKeyboard.js.map +1 -1
  86. package/dist/useNavigation.js.map +1 -1
  87. package/dist/useRefEffect.js.map +1 -1
  88. package/next-env.d.ts +2 -1
  89. package/next.config.js +2 -1
  90. package/package.json +27 -20
  91. package/src/Badge.tsx +2 -2
  92. package/src/BaseButton.tsx +4 -4
  93. package/src/BaseInput.tsx +2 -2
  94. package/src/BaseLink.tsx +4 -4
  95. package/src/BaseListItem.tsx +3 -3
  96. package/src/BaseView.tsx +3 -3
  97. package/src/Calendar.tsx +4 -4
  98. package/src/DateInput.tsx +2 -2
  99. package/src/DatetimeInput.tsx +2 -2
  100. package/src/Dialog.tsx +3 -3
  101. package/src/Dropdown.tsx +4 -4
  102. package/src/Icon.tsx +4 -30
  103. package/src/IconLink.tsx +2 -1
  104. package/src/Interactable.tsx +4 -4
  105. package/src/ListButtonItem.tsx +2 -2
  106. package/src/ListLinkItem.tsx +2 -2
  107. package/src/MenuIcon.tsx +2 -2
  108. package/src/NextJSRouter.tsx +2 -2
  109. package/src/Popover.tsx +9 -9
  110. package/src/ProgressBar.tsx +3 -3
  111. package/src/Providers.tsx +4 -4
  112. package/src/RangeInput.tsx +5 -5
  113. package/src/Select.tsx +2 -2
  114. package/src/StaticCheckbox.tsx +2 -2
  115. package/src/Storage.tsx +1 -1
  116. package/src/Sublist.tsx +2 -2
  117. package/src/Tabs.tsx +4 -6
  118. package/src/Text.tsx +2 -2
  119. package/src/TextArea.tsx +2 -2
  120. package/src/TextInput.tsx +20 -8
  121. package/src/TextPairing.tsx +2 -2
  122. package/src/Tooltip.tsx +5 -5
  123. package/src/docs/mdx.tsx +40 -0
  124. package/src/docs/searchIndex.ts +1 -1
  125. package/src/jss.tsx +18 -18
  126. package/src/pages/Badge.mdx +136 -14
  127. package/src/pages/Button.mdx +121 -63
  128. package/src/pages/Calendar.mdx +196 -2
  129. package/src/pages/Card.mdx +123 -47
  130. package/src/pages/Checkbox.mdx +103 -28
  131. package/src/pages/Dialog.mdx +172 -7
  132. package/src/pages/FlexLayout.mdx +185 -51
  133. package/src/pages/Hashing.mdx +199 -8
  134. package/src/pages/Icon.mdx +150 -42
  135. package/src/pages/IconButton.mdx +127 -116
  136. package/src/pages/Link.mdx +118 -47
  137. package/src/pages/List.mdx +167 -283
  138. package/src/pages/ListHeader.mdx +157 -27
  139. package/src/pages/Popover.mdx +177 -55
  140. package/src/pages/ProgressBar.mdx +186 -6
  141. package/src/pages/ProgressCircle.mdx +196 -13
  142. package/src/pages/RangeInput.mdx +189 -61
  143. package/src/pages/Tabs.mdx +202 -346
  144. package/src/pages/Text.mdx +102 -81
  145. package/src/pages/TextInput.mdx +169 -44
  146. package/src/pages/TextPairing.mdx +164 -115
  147. package/src/pages/TimeInput.mdx +142 -37
  148. package/src/pages/Tooltip.mdx +99 -12
  149. package/src/pages/_app.tsx +14 -4
  150. package/src/pages/css-in-js.mdx +196 -83
  151. package/src/pages/navigation.mdx +122 -20
  152. package/src/pages/useCookie.mdx +168 -7
  153. package/src/pages/useKeyboard.mdx +242 -5
  154. package/src/pages/useNavigation.mdx +244 -16
  155. package/src/pages/usePromise.mdx +271 -6
  156. package/src/pages/useRefEffect.mdx +230 -28
  157. package/tsconfig.json +13 -4
@@ -1,133 +1,154 @@
1
1
  import { Column } from "../Column";
2
- import { Text, Span, P, H1, H2, H3, Li } from "../Text";
2
+ import { Row } from "../Row";
3
+ import { Text, Span, P, H1, H2, H3, Li, Label } from "../Text";
3
4
 
4
5
  # Text
5
6
 
6
- The `Text` component has mant props and is central to many of the other components, that make use of it to ensure consistent styles accross the desgin system.
7
+ The `Text` component is the foundation for all text rendering in the design system. It provides consistent typography with semantic color and size options.
7
8
 
8
9
  ---
9
10
 
10
- ## Semantic API
11
+ ## Props
11
12
 
12
- In general the `Text` component is too flexible for general use, since it has many props that can lead to jarring styling. Instead, there is a higher level API that replicates HTML semantics with consitent stylin. These are really thin wrappers around `Text` that can be custimased to the same level; and one can still use `Text` whenever semantics are not important and there is need for very specific styling.
13
+ | Prop | Type | Required | Default | Description |
14
+ |------|------|----------|---------|-------------|
15
+ | `children` | `ReactNode` | Yes | - | Text content |
16
+ | `color` | `TextColor` | No | `"primary"` | `"primary"`, `"secondary"`, `"highlight"`, `"negative"`, `"subtle"`, `"light"`, `"inherit"` |
17
+ | `size` | `Size` | No | `"medium"` | `"xsmall"`, `"small"`, `"medium"`, `"large"`, `"xlarge"`, `"xxlarge"`, `"xxxlarge"` |
18
+ | `bold` | `boolean` | No | `false` | Bold font weight |
19
+ | `ellipsis` | `boolean` | No | varies | Truncate text with ellipsis when overflow |
20
+ | `align` | `"center"` \| `"none"` | No | `"none"` | Text alignment |
21
+ | `type` | `TextType` | No | `"span"` | HTML element: `"span"`, `"p"`, `"h1"`, `"h2"`, `"h3"`, `"h4"`, `"li"`, `"label"` |
22
+ | `grow` | `boolean` | No | `false` | Allow text to grow in flex container |
13
23
 
14
- <Column gap="medium">
15
- <Span>Span</Span>
16
- <P>P</P>
17
- <H1 tag="h2">H1</H1>
18
- <H2>H2</H2>
19
- <H3>H3</H3>
20
- <Li>Li</Li>
21
- </Column>
24
+ ---
22
25
 
23
- <br />
24
- \* If you inspect the DOM you will see that in the previous example I override the
25
- HTML tag for the component `H1` because having more than one H1 is discouraged for
26
- accessibility.
26
+ ## Semantic components
27
+
28
+ For most use cases, prefer the semantic wrapper components over the base `Text` component. They provide sensible defaults and render the appropriate HTML elements.
27
29
 
28
- ```js
29
30
  <Column gap="medium">
30
- <Span>Span</Span>
31
- <P>P</P>
32
- <H1>H1</H1>
33
- <H2>H2</H2>
34
- <H3>H3</H3>
35
- <Li>Li</Li>
31
+ <H1 tag="h2">H1 - Page titles</H1>
32
+ <H2 tag="h3">H2 - Section headings</H2>
33
+ <H3 tag="h4">H3 - Subsection headings</H3>
34
+ <P>P - Paragraph text for body content</P>
35
+ <Span>Span - Inline text (truncates by default)</Span>
36
+ <Li>Li - List items</Li>
37
+ <Label>Label - Form labels</Label>
36
38
  </Column>
39
+
40
+ ```js
41
+ import { H1, H2, H3, P, Span, Li, Label } from "aidos-ui";
42
+
43
+ <H1>Page Title</H1> // xxlarge, renders <h1>
44
+ <H2>Section Heading</H2> // xlarge, renders <h2>
45
+ <H3>Subsection</H3> // large, renders <h3>
46
+ <P>Body text paragraph</P> // medium, renders <p>
47
+ <Span>Inline text</Span> // medium, renders <span>, ellipsis enabled
48
+ <Li>List item</Li> // medium, renders <li>
49
+ <Label>Form label</Label> // medium, renders <label>
37
50
  ```
38
51
 
39
52
  ---
40
53
 
41
- ## Size
54
+ ## Sizes
55
+
56
+ Text sizes map to CSS custom properties, ensuring consistency with the theme system.
42
57
 
43
58
  <Column gap="medium">
44
- <Text size="xsmall">{"xsmall"}</Text>
45
- <Text size="small">{"small"}</Text>
46
- <Text size="medium">{"medium"}</Text>
47
- <Text size="large">{"large"}</Text>
48
- <Text size="xlarge">{"xlarge"}</Text>
59
+ <Text size="xsmall">xsmall - Fine print, captions</Text>
60
+ <Text size="small">small - Secondary text, labels</Text>
61
+ <Text size="medium">medium - Body text (default)</Text>
62
+ <Text size="large">large - Emphasized text, H3</Text>
63
+ <Text size="xlarge">xlarge - Subheadings, H2</Text>
64
+ <Text size="xxlarge">xxlarge - Page titles, H1</Text>
65
+ <Text size="xxxlarge">xxxlarge - Hero text</Text>
49
66
  </Column>
50
67
 
51
68
  ```js
52
- <Column gap="medium">
53
- <Text size="xsmall">xsmall</Text>
54
- <Text size="small">small</Text>
55
- <Text size="medium">medium</Text>
56
- <Text size="large">large</Text>
57
- <Text size="xlarge">xlarge</Text>
58
- </Column>
69
+ <Text size="xsmall">Fine print</Text>
70
+ <Text size="small">Secondary text</Text>
71
+ <Text size="medium">Body text</Text>
72
+ <Text size="large">Emphasized</Text>
73
+ <Text size="xlarge">Subheading</Text>
74
+ <Text size="xxlarge">Title</Text>
75
+ <Text size="xxxlarge">Hero</Text>
59
76
  ```
60
77
 
61
78
  ---
62
79
 
63
- ## Color
80
+ ## Colors
81
+
82
+ Semantic colors ensure text adapts correctly to light and dark themes.
64
83
 
65
84
  <Column gap="medium">
66
- <Text color="primary">{"primary"}</Text>
67
- <Text color="secondary">{"secondary"}</Text>
68
- <Text color="highlight">{"highlight"}</Text>
69
- <Text color="negative">{"negative"}</Text>
70
- <Text color="subtle">{"subtle"}</Text>
71
- <Text color="light">{"light"}</Text>
72
- <Text color="inherit">{"inherit"}</Text>
85
+ <Text color="primary">primary - Main content text</Text>
86
+ <Text color="secondary">secondary - Supporting text</Text>
87
+ <Text color="highlight">highlight - Links, accents, brand color</Text>
88
+ <Text color="negative">negative - Errors, warnings, destructive</Text>
89
+ <Text color="subtle">subtle - Disabled, placeholder text</Text>
90
+ <Text color="light">light - Text on dark backgrounds</Text>
91
+ <Text color="inherit">inherit - Inherits parent color</Text>
73
92
  </Column>
74
93
 
75
94
  ```js
76
- <Column gap="medium">
77
- <Text color="primary">{"primary"}</Text>
78
- <Text color="secondary">{"secondary"}</Text>
79
- <Text color="highlight">{"highlight"}</Text>
80
- <Text color="negative">{"negative"}</Text>
81
- <Text color="subtle">{"subtle"}</Text>
82
- <Text color="light">{"light"}</Text>
83
- <Text color="inherit">{"inherit"}</Text>
84
- </Column>
95
+ <Text color="primary">Main content</Text>
96
+ <Text color="secondary">Supporting info</Text>
97
+ <Text color="highlight">Accent text</Text>
98
+ <Text color="negative">Error message</Text>
99
+ <Text color="subtle">Disabled text</Text>
85
100
  ```
86
101
 
87
102
  ---
88
103
 
89
- ## Bold
104
+ ## Bold text
90
105
 
91
- <Column gap="medium">
92
- <Text bold>{"bold"}</Text>
93
- <Text>{"not bold"}</Text>
94
- </Column>
106
+ <Row gap="large">
107
+ <Text bold>Bold text for emphasis</Text>
108
+ <Text>Regular weight text</Text>
109
+ </Row>
95
110
 
96
111
  ```js
97
- <Column gap="medium">
98
- <Text bold>{"bold"}</Text>
99
- <Text>{"not bold"}</Text>
100
- </Column>
112
+ <Text bold>Important information</Text>
113
+ <Text>Regular text</Text>
101
114
  ```
102
115
 
103
116
  ---
104
117
 
105
- ## Ellipsis
118
+ ## Ellipsis truncation
106
119
 
107
- By default ellipsis is enabled in the `Span` element, but can be configured with the `ellipsis` prop.
120
+ By default, `Span` and `Label` components truncate text with ellipsis. Other components wrap by default.
108
121
 
109
- ---
110
-
111
- ### Span
112
-
113
- <Column>
122
+ <Column gap="medium" jss={{ maxWidth: 300 }}>
114
123
  <Span>
115
- {
116
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
117
- }
124
+ This span text will truncate with ellipsis when it overflows the container width
118
125
  </Span>
126
+ <P>
127
+ This paragraph text will wrap to multiple lines when it exceeds the container width instead of truncating
128
+ </P>
119
129
  </Column>
120
130
 
121
- ---
131
+ ```js
132
+ // Truncates by default
133
+ <Span>Long text that will be truncated...</Span>
122
134
 
123
- ### P
135
+ // Force truncation on any text component
136
+ <P ellipsis>This paragraph will truncate</P>
124
137
 
125
- <Column>
126
- <P>
127
- {
128
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
129
- }
130
- </P>
131
- </Column>
138
+ // Disable truncation on span
139
+ <Span ellipsis={false}>This span will wrap</Span>
140
+ ```
132
141
 
133
142
  ---
143
+
144
+ ## Custom HTML element
145
+
146
+ Override the rendered HTML element while keeping the same styling using the `type` prop.
147
+
148
+ ```js
149
+ // Render H1 styling but use h2 element (for accessibility)
150
+ <H1 type="h2">Visually large, semantically h2</H1>
151
+
152
+ // Render span styling as a label
153
+ <Span type="label" htmlFor="email">Email address</Span>
154
+ ```
@@ -5,106 +5,231 @@ import { TextInput } from "../TextInput";
5
5
 
6
6
  # TextInput
7
7
 
8
- The `TextInput` component is an `HTML` input with some extra markup to support more advanced styles, like icons.
8
+ A styled text input field with support for icons and add-ons. Built on top of the native HTML input element with enhanced styling options.
9
9
 
10
- ## Base TextInput
10
+ ---
11
+
12
+ ## Props
13
+
14
+ | Prop | Type | Required | Default | Description |
15
+ |------|------|----------|---------|-------------|
16
+ | `value` | `string` | Yes | - | Input value (controlled) |
17
+ | `onValueChange` | `(value: string) => void` | No | - | Callback when value changes |
18
+ | `placeholder` | `string` | No | - | Placeholder text |
19
+ | `addOn` | `ReactNode` | No | - | Element displayed inside the input (typically an icon) |
20
+ | `addOnPosition` | `"start"` \| `"end"` | No | `"start"` | Add-on placement |
21
+ | `bare` | `boolean` | No | `false` | Minimal styling without border |
22
+ | `size` | `Size` | No | `"medium"` | Font size (matches Button sizing) |
23
+ | `padding` | `Padding` | No | `"medium"` | Internal padding |
24
+ | `gap` | `Gap` | No | `"small"` | Space between add-on and input |
25
+ | `disabled` | `boolean` | No | `false` | Disables the input |
26
+ | `type` | `string` | No | `"text"` | HTML input type |
27
+ | `jss` | `JSS` | No | - | Custom styles for the input element |
28
+ | `jssRoot` | `JSS` | No | - | Custom styles for the container |
29
+
30
+ Also accepts all standard HTML input attributes (`name`, `id`, `autoFocus`, `maxLength`, etc.).
31
+
32
+ ---
33
+
34
+ ## Basic usage
11
35
 
12
36
  <Column gap="medium">
13
37
  <TextInput
14
38
  value=""
15
- placeholder="Placeholder text input"
39
+ placeholder="Enter your name"
16
40
  onValueChange={() => {}}
17
41
  />
18
- <TextInput value="Text input" onValueChange={() => {}} />
19
42
  <TextInput
20
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
21
- value="Text input"
22
- onValueChange={() => {}}
23
- />
24
- <TextInput
25
- value="Text input"
26
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
27
- addOnPosition="end"
28
- placeholder="Placeholder text input"
43
+ value="John Doe"
29
44
  onValueChange={() => {}}
30
45
  />
31
46
  </Column>
32
47
 
33
48
  ```js
49
+ const [name, setName] = useState("");
50
+
51
+ <TextInput
52
+ value={name}
53
+ placeholder="Enter your name"
54
+ onValueChange={setName}
55
+ />
56
+ ```
57
+
58
+ ---
59
+
60
+ ## With add-on
61
+
62
+ Add icons to provide visual context. Icons can be placed at the start or end of the input.
63
+
34
64
  <Column gap="medium">
35
65
  <TextInput
36
- value=""
37
- placeholder="Placeholder text input"
66
+ value="john@example.com"
67
+ addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
38
68
  onValueChange={() => {}}
39
69
  />
40
- <TextInput value="Text input" onValueChange={() => {}} />
41
70
  <TextInput
42
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
43
- value="Text input"
71
+ value=""
72
+ placeholder="Search..."
73
+ addOn={<Icon icon="fa-search" color="secondary" size="medium" />}
44
74
  onValueChange={() => {}}
45
75
  />
46
76
  <TextInput
47
- value="Text input"
48
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
77
+ value="Secret"
78
+ placeholder="Password"
79
+ addOn={<Icon icon="fa-lock" color="secondary" size="medium" />}
49
80
  addOnPosition="end"
50
- placeholder="Placeholder text input"
81
+ type="password"
51
82
  onValueChange={() => {}}
52
83
  />
53
84
  </Column>
85
+
86
+ ```js
87
+ // Icon at start (default)
88
+ <TextInput
89
+ value={email}
90
+ addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
91
+ onValueChange={setEmail}
92
+ />
93
+
94
+ // Icon at end
95
+ <TextInput
96
+ value={password}
97
+ addOn={<Icon icon="fa-lock" color="secondary" size="medium" />}
98
+ addOnPosition="end"
99
+ type="password"
100
+ onValueChange={setPassword}
101
+ />
54
102
  ```
55
103
 
56
104
  ---
57
105
 
58
- ## Bare TextInput
106
+ ## Bare variant
107
+
108
+ The `bare` variant removes the border for a minimal look. The background highlights on focus.
59
109
 
60
110
  <Column gap="medium">
61
111
  <TextInput
62
112
  bare
63
113
  value=""
64
- placeholder="Placeholder text input"
114
+ placeholder="Minimal input"
65
115
  onValueChange={() => {}}
66
116
  />
67
- <TextInput bare value="Text input" onValueChange={() => {}} />
68
117
  <TextInput
69
118
  bare
119
+ value="With icon"
70
120
  addOn={<Icon icon="fa-user" color="primary" size="medium" />}
71
- value="Text input"
72
- onValueChange={() => {}}
73
- />
74
- <TextInput
75
- bare
76
- value="Text input"
77
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
78
- addOnPosition="end"
79
- placeholder="Placeholder text input"
80
121
  onValueChange={() => {}}
81
122
  />
82
123
  </Column>
83
124
 
84
125
  ```js
126
+ <TextInput
127
+ bare
128
+ value={value}
129
+ placeholder="Search"
130
+ addOn={<Icon icon="fa-search" color="secondary" size="medium" />}
131
+ onValueChange={setValue}
132
+ />
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Sizes
138
+
139
+ The `size` prop controls font size and matches the Button component's sizing system.
140
+
85
141
  <Column gap="medium">
86
142
  <TextInput
87
- bare
143
+ size="small"
88
144
  value=""
89
- placeholder="Placeholder text input"
145
+ placeholder="Small input"
90
146
  onValueChange={() => {}}
91
147
  />
92
- <TextInput bare value="Text input" onValueChange={() => {}} />
93
148
  <TextInput
94
- bare
95
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
96
- value="Text input"
149
+ size="medium"
150
+ value=""
151
+ placeholder="Medium input (default)"
97
152
  onValueChange={() => {}}
98
153
  />
99
154
  <TextInput
100
- bare
101
- value="Text input"
102
- addOn={<Icon icon="fa-user" color="primary" size="medium" />}
103
- addOnPosition="end"
104
- placeholder="Placeholder text input"
155
+ size="large"
156
+ value=""
157
+ placeholder="Large input"
158
+ onValueChange={() => {}}
159
+ />
160
+ </Column>
161
+
162
+ ```js
163
+ <TextInput size="small" ... />
164
+ <TextInput size="medium" ... /> // default
165
+ <TextInput size="large" ... />
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Disabled state
171
+
172
+ <Column gap="medium">
173
+ <TextInput
174
+ value="Disabled input"
175
+ disabled
105
176
  onValueChange={() => {}}
106
177
  />
107
178
  </Column>
179
+
180
+ ```js
181
+ <TextInput
182
+ value="Cannot edit"
183
+ disabled
184
+ onValueChange={() => {}}
185
+ />
108
186
  ```
109
187
 
110
188
  ---
189
+
190
+ ## Form integration
191
+
192
+ TextInput works with standard form patterns and can be used with refs for form libraries.
193
+
194
+ ```js
195
+ import { useRef } from "react";
196
+
197
+ function Form() {
198
+ const inputRef = useRef<HTMLInputElement>(null);
199
+ const [value, setValue] = useState("");
200
+
201
+ return (
202
+ <form onSubmit={handleSubmit}>
203
+ <TextInput
204
+ ref={inputRef}
205
+ name="email"
206
+ type="email"
207
+ value={value}
208
+ placeholder="Email address"
209
+ onValueChange={setValue}
210
+ addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
211
+ />
212
+ </form>
213
+ );
214
+ }
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Accessibility
220
+
221
+ - Uses native `<input>` element for full accessibility support
222
+ - Focus states are clearly visible
223
+ - Placeholder text is styled with sufficient contrast
224
+ - Works with form labels using `id` and `htmlFor`
225
+
226
+ ```js
227
+ <label htmlFor="email">Email</label>
228
+ <TextInput
229
+ id="email"
230
+ name="email"
231
+ type="email"
232
+ value={email}
233
+ onValueChange={setEmail}
234
+ />
235
+ ```