@ceed/cds 1.22.3 → 1.22.4

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 (44) hide show
  1. package/dist/components/data-display/InfoSign.md +74 -91
  2. package/dist/components/data-display/Typography.md +363 -63
  3. package/dist/components/feedback/CircularProgress.md +257 -0
  4. package/dist/components/feedback/Skeleton.md +280 -0
  5. package/dist/components/feedback/llms.txt +2 -0
  6. package/dist/components/inputs/ButtonGroup.md +115 -104
  7. package/dist/components/inputs/CurrencyInput.md +181 -8
  8. package/dist/components/inputs/DatePicker.md +108 -436
  9. package/dist/components/inputs/DateRangePicker.md +130 -496
  10. package/dist/components/inputs/FilterableCheckboxGroup.md +141 -20
  11. package/dist/components/inputs/FormControl.md +368 -0
  12. package/dist/components/inputs/IconButton.md +137 -88
  13. package/dist/components/inputs/Input.md +203 -77
  14. package/dist/components/inputs/MonthPicker.md +95 -427
  15. package/dist/components/inputs/MonthRangePicker.md +89 -471
  16. package/dist/components/inputs/PercentageInput.md +183 -19
  17. package/dist/components/inputs/RadioButton.md +163 -35
  18. package/dist/components/inputs/RadioList.md +241 -0
  19. package/dist/components/inputs/RadioTileGroup.md +146 -62
  20. package/dist/components/inputs/Select.md +219 -328
  21. package/dist/components/inputs/Slider.md +334 -0
  22. package/dist/components/inputs/Switch.md +143 -376
  23. package/dist/components/inputs/Textarea.md +209 -11
  24. package/dist/components/inputs/Uploader/Uploader.md +145 -66
  25. package/dist/components/inputs/llms.txt +3 -0
  26. package/dist/components/navigation/Breadcrumbs.md +57 -308
  27. package/dist/components/navigation/Drawer.md +180 -0
  28. package/dist/components/navigation/Dropdown.md +98 -215
  29. package/dist/components/navigation/IconMenuButton.md +40 -502
  30. package/dist/components/navigation/InsetDrawer.md +281 -650
  31. package/dist/components/navigation/Link.md +31 -348
  32. package/dist/components/navigation/Menu.md +92 -285
  33. package/dist/components/navigation/MenuButton.md +55 -448
  34. package/dist/components/navigation/Pagination.md +47 -338
  35. package/dist/components/navigation/Stepper.md +160 -28
  36. package/dist/components/navigation/Tabs.md +57 -316
  37. package/dist/components/surfaces/Accordions.md +49 -804
  38. package/dist/components/surfaces/Card.md +97 -157
  39. package/dist/components/surfaces/Divider.md +83 -234
  40. package/dist/components/surfaces/Sheet.md +152 -327
  41. package/dist/guides/ThemeProvider.md +89 -0
  42. package/dist/guides/llms.txt +9 -0
  43. package/dist/llms.txt +8 -0
  44. package/package.json +1 -1
@@ -2,9 +2,11 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- FilterableCheckboxGroup 컴포넌트는 대량의 옵션 중에서 여러 항목을 선택할 있는 검색 가능한 체크박스 그룹입니다. 검색 필터링과 가상 스크롤링을 통해 많은 수의 옵션을 효율적으로 처리할 있으며, "Select all" 기능으로 일괄 선택이 가능합니다. 필터링, 다중 선택 폼, 설정 화면 등에서 유용하게 사용됩니다.
5
+ FilterableCheckboxGroup is a multi-select component that combines a search input with a scrollable list of checkboxes. It is designed for scenarios where users need to select multiple items from a potentially large dataset. The built-in search filter narrows down visible options in real time, and virtual scrolling ensures smooth performance even with hundreds of items.
6
6
 
7
- > 💡 **Form 구성 내장 prop 사용을 권장합니다**
7
+ Key capabilities include a "Select all" toggle for bulk selection, automatic sorting (selected items first, then alphabetical), customizable list height, and built-in form integration via `label`, `helperText`, and `required` props. The component accepts options as either simple strings or `{ value, label }` objects.
8
+
9
+ > **Form 구성 시 내장 prop 사용을 권장합니다**
8
10
  >
9
11
  > 이 컴포넌트는 `label`, `helperText` 등의 Form 요소를 자체적으로 지원합니다.
10
12
  > Form을 구성할 때 Typography로 별도의 label이나 helperText를 만드는 대신, 컴포넌트의 내장 prop을 사용하세요.
@@ -32,7 +34,7 @@ FilterableCheckboxGroup 컴포넌트는 대량의 옵션 중에서 여러 항목
32
34
  ## Usage
33
35
 
34
36
  ```tsx
35
- import { FilterableCheckboxGroup } from '@ceed/ads';
37
+ import { FilterableCheckboxGroup } from '@ceed/cds';
36
38
 
37
39
  function MyComponent() {
38
40
  const [selectedValues, setSelectedValues] = useState<string[]>([]);
@@ -55,11 +57,9 @@ function MyComponent() {
55
57
  }
56
58
  ```
57
59
 
58
- ## Examples
59
-
60
- ### Sizes
60
+ ## Sizes
61
61
 
62
- 다양한 크기의 FilterableCheckboxGroup을 사용할 있습니다.
62
+ Three sizes are available: `sm`, `md`, and `lg`. The size affects the search input, checkboxes, and overall spacing.
63
63
 
64
64
  ```tsx
65
65
  <Stack spacing={3}>
@@ -69,9 +69,11 @@ function MyComponent() {
69
69
  </Stack>
70
70
  ```
71
71
 
72
+ ## Label and Helper Text
73
+
72
74
  ### With Label
73
75
 
74
- 라벨을 추가할 있습니다.
76
+ Use the `label` prop to describe the purpose of the checkbox group.
75
77
 
76
78
  ```tsx
77
79
  <FilterableCheckboxGroup
@@ -83,7 +85,7 @@ function MyComponent() {
83
85
 
84
86
  ### With Helper Text
85
87
 
86
- 도움말 텍스트를 추가할 있습니다.
88
+ Add a `helperText` prop to provide additional guidance below the component.
87
89
 
88
90
  ```tsx
89
91
  <FilterableCheckboxGroup
@@ -96,7 +98,7 @@ function MyComponent() {
96
98
 
97
99
  ### Required Field
98
100
 
99
- 필수 입력 필드로 표시할 있습니다.
101
+ Set `required` to append a required indicator to the label.
100
102
 
101
103
  ```tsx
102
104
  <FilterableCheckboxGroup
@@ -108,9 +110,9 @@ function MyComponent() {
108
110
  />
109
111
  ```
110
112
 
111
- ### Custom Max Height
113
+ ## Custom Max Height
112
114
 
113
- 목록의 최대 높이를 커스터마이징할 있습니다.
115
+ Control the visible height of the options list with the `maxHeight` prop (default: 300px). A smaller height is useful when screen space is limited.
114
116
 
115
117
  ```tsx
116
118
  <Stack spacing={3}>
@@ -119,9 +121,9 @@ function MyComponent() {
119
121
  </Stack>
120
122
  ```
121
123
 
122
- ### Long List
124
+ ## Long List with Virtual Scrolling
123
125
 
124
- 많은 수의 옵션을 가상 스크롤링으로 효율적으로 표시합니다.
126
+ When the options list is large, the component uses virtual scrolling to render only the visible items. This keeps the UI performant regardless of the total number of options.
125
127
 
126
128
  ```tsx
127
129
  <FilterableCheckboxGroup
@@ -134,9 +136,9 @@ function MyComponent() {
134
136
  />
135
137
  ```
136
138
 
137
- ### No Options
139
+ ## Empty State
138
140
 
139
- 옵션이 없을 때의 상태입니다.
141
+ When no options are provided, the component displays an empty state. This is useful for dynamically loaded option lists that may start empty.
140
142
 
141
143
  ```tsx
142
144
  <FilterableCheckboxGroup
@@ -146,9 +148,9 @@ function MyComponent() {
146
148
  />
147
149
  ```
148
150
 
149
- ### Controlled
151
+ ## Controlled Mode
150
152
 
151
- 외부에서 값을 제어하는 예제입니다.
153
+ Pass `value` and `onChange` to manage the selection state externally. This is the recommended approach when the component is part of a form or when the selected values need to be used by other parts of the UI.
152
154
 
153
155
  ```tsx
154
156
  <Stack spacing={2}>
@@ -160,9 +162,9 @@ function MyComponent() {
160
162
  </Stack>
161
163
  ```
162
164
 
163
- ### Sorting
165
+ ## Sorting Behavior
164
166
 
165
- 정렬 동작을 확인할 있는 예제입니다. 초기 렌더링 선택된 항목이 먼저 표시되고, 다음 알파벳 순으로 정렬됩니다.
167
+ The component automatically sorts options on initial render: selected items appear first, followed by unselected items in alphabetical order. When new options are added dynamically, they are inserted in the correct sorted position.
166
168
 
167
169
  ```tsx
168
170
  <Stack spacing={2}>
@@ -195,3 +197,122 @@ function MyComponent() {
195
197
  </Typography>
196
198
  </Stack>
197
199
  ```
200
+
201
+ ## Disabled State
202
+
203
+ The component supports both full and partial disabling.
204
+
205
+ - **Full disable**: Set `disabled` on the component to disable the search input, "Select all" toggle, and all checkboxes.
206
+ - **Partial disable**: Set `disabled: true` on individual option objects to disable specific items while keeping the rest interactive.
207
+ - **"Select all" behavior**: Disabled options are excluded from the "Select all" toggle. Their selected state is preserved regardless of bulk actions.
208
+
209
+ ```tsx
210
+ <Stack spacing={3}>
211
+ <FilterableCheckboxGroup label="Entirely Disabled" placeholder="Search..." helperText="All inputs are disabled" options={defaultOptions.slice(0, 5)} disabled />
212
+ <FilterableCheckboxGroup label="Partially Disabled Options" placeholder="Search..." helperText="Some options are disabled" options={disabledOptions} />
213
+ <Stack spacing={2}>
214
+ <FilterableCheckboxGroup label="Controlled + Partially Disabled" placeholder="Search..." helperText="Disabled options (Banana, Date) maintain their selected state" options={disabledOptions} value={controlledValue} onChange={setControlledValue} />
215
+ <Typography level="body-sm">
216
+ Selected: {controlledValue.length > 0 ? controlledValue.join(', ') : 'None'}
217
+ </Typography>
218
+ <Typography level="body-sm" sx={{
219
+ color: 'text.secondary'
220
+ }}>
221
+ Try "Select all" - it will only affect enabled options (Apple, Cherry, Elderberry)
222
+ </Typography>
223
+ </Stack>
224
+ </Stack>
225
+ ```
226
+
227
+ ## Common Use Cases
228
+
229
+ ### Filter Panel
230
+
231
+ Use FilterableCheckboxGroup in a sidebar or panel to let users filter a data table or list by multiple criteria.
232
+
233
+ ```tsx
234
+ import { FilterableCheckboxGroup } from '@ceed/cds';
235
+
236
+ function FilterPanel({ categories, onFilterChange }) {
237
+ const [selected, setSelected] = useState<string[]>([]);
238
+
239
+ const handleChange = (values: string[]) => {
240
+ setSelected(values);
241
+ onFilterChange(values);
242
+ };
243
+
244
+ return (
245
+ <FilterableCheckboxGroup
246
+ label="Categories"
247
+ placeholder="Search categories..."
248
+ options={categories}
249
+ value={selected}
250
+ onChange={handleChange}
251
+ maxHeight={200}
252
+ />
253
+ );
254
+ }
255
+ ```
256
+
257
+ ### User Role Assignment
258
+
259
+ Assign multiple roles to a user from a searchable list.
260
+
261
+ ```tsx
262
+ <FilterableCheckboxGroup
263
+ label="Assign Roles"
264
+ placeholder="Search roles..."
265
+ helperText="Select all roles that apply to this user"
266
+ options={[
267
+ { value: 'admin', label: 'Administrator' },
268
+ { value: 'editor', label: 'Editor' },
269
+ { value: 'viewer', label: 'Viewer' },
270
+ { value: 'moderator', label: 'Moderator' },
271
+ { value: 'billing', label: 'Billing Manager' },
272
+ ]}
273
+ required
274
+ value={selectedRoles}
275
+ onChange={setSelectedRoles}
276
+ />
277
+ ```
278
+
279
+ ### Region / Country Selection
280
+
281
+ When dealing with a large set of options like countries, the search filter and virtual scrolling work together for fast selection.
282
+
283
+ ```tsx
284
+ <FilterableCheckboxGroup
285
+ label="Service Regions"
286
+ placeholder="Search countries..."
287
+ options={allCountries.map((c) => ({ value: c.code, label: c.name }))}
288
+ value={selectedCountries}
289
+ onChange={setSelectedCountries}
290
+ />
291
+ ```
292
+
293
+ ## Best Practices
294
+
295
+ 1. **Provide a meaningful placeholder.** The search input placeholder should hint at the type of content being filtered (e.g., "Search countries..." instead of a generic "Search...").
296
+
297
+ ```tsx
298
+ // ✅ Specific and helpful
299
+ <FilterableCheckboxGroup placeholder="Search countries..." />
300
+
301
+ // ❌ Too generic
302
+ <FilterableCheckboxGroup placeholder="Type here..." />
303
+ ```
304
+
305
+ 2. **Use `maxHeight` to fit the layout.** In tight spaces like sidebars or modals, set a smaller `maxHeight` to prevent the component from dominating the layout.
306
+
307
+ 3. **Prefer controlled mode for form integration.** Always pass `value` and `onChange` when the selected values participate in form submission or affect other UI state.
308
+
309
+ 4. **Leverage individual `disabled` for permissions.** When some options should be visible but not selectable (e.g., due to user permissions), disable them individually rather than hiding them. This communicates availability without surprising users.
310
+
311
+ 5. **Keep option labels concise.** Long labels will be truncated with an ellipsis. If detailed descriptions are needed, consider using a tooltip or a separate detail view.
312
+
313
+ ## Accessibility
314
+
315
+ - The search input is labeled by the component's `label` prop, ensuring screen readers announce its purpose.
316
+ - Each checkbox option uses a native `<input type="checkbox">` with an associated `<label>`, enabling click-on-label and proper screen reader announcements.
317
+ - The "Select all" toggle clearly communicates its tri-state behavior (all, none, indeterminate) to assistive technologies.
318
+ - Keyboard navigation is fully supported: Tab to move between the search input and the checkbox list, Space to toggle individual checkboxes, and standard arrow keys to navigate within the list.
@@ -0,0 +1,368 @@
1
+ # FormControl
2
+
3
+ ## Introduction
4
+
5
+ FormControl is a wrapper component that provides context to form elements such as Input, Textarea, Select, and more. It manages shared states like `error`, `disabled`, `required`, and `size`, passing them down to its children automatically. Use it with FormLabel and FormHelperText to build accessible, consistent form fields.
6
+
7
+ ```tsx
8
+ <FormControl {...args}>
9
+ <FormLabel>Label</FormLabel>
10
+ <Input placeholder="Enter text…" />
11
+ <FormHelperText>This is helper text.</FormHelperText>
12
+ </FormControl>
13
+ ```
14
+
15
+ | Field | Description | Default |
16
+ | ----------- | ----------- | ------- |
17
+ | size | — | — |
18
+ | error | — | — |
19
+ | disabled | — | — |
20
+ | required | — | — |
21
+ | orientation | — | — |
22
+
23
+ ## Usage
24
+
25
+ ```tsx
26
+ import { FormControl, FormLabel, FormHelperText, Input } from '@ceed/cds';
27
+
28
+ function MyForm() {
29
+ return (
30
+ <FormControl>
31
+ <FormLabel>Username</FormLabel>
32
+ <Input placeholder="Enter username" />
33
+ <FormHelperText>Choose a unique username.</FormHelperText>
34
+ </FormControl>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## With Input
40
+
41
+ The most common pattern — wrapping an Input with a label and helper text.
42
+
43
+ ```tsx
44
+ <FormControl>
45
+ <FormLabel>Username</FormLabel>
46
+ <Input placeholder="Enter username" />
47
+ <FormHelperText>Choose a unique username.</FormHelperText>
48
+ </FormControl>
49
+ ```
50
+
51
+ ## With Textarea
52
+
53
+ FormControl works equally well with Textarea components.
54
+
55
+ ```tsx
56
+ <FormControl>
57
+ <FormLabel>Description</FormLabel>
58
+ <Textarea placeholder="Enter description…" minRows={3} />
59
+ <FormHelperText>Provide a detailed description.</FormHelperText>
60
+ </FormControl>
61
+ ```
62
+
63
+ ## With Select
64
+
65
+ Use FormControl with Select for dropdown fields.
66
+
67
+ ```tsx
68
+ <FormControl>
69
+ <FormLabel>Role</FormLabel>
70
+ <Select placeholder="Select a role">
71
+ <Option value="admin">Admin</Option>
72
+ <Option value="editor">Editor</Option>
73
+ <Option value="viewer">Viewer</Option>
74
+ </Select>
75
+ <FormHelperText>Select the user role.</FormHelperText>
76
+ </FormControl>
77
+ ```
78
+
79
+ ## Error State
80
+
81
+ Set `error` on FormControl to propagate the error state to all child components. FormHelperText automatically changes color to indicate the error.
82
+
83
+ ```tsx
84
+ <FormControl error>
85
+ <FormLabel>Email</FormLabel>
86
+ <Input placeholder="email@example.com" value="invalid-email" />
87
+ <FormHelperText>Please enter a valid email address.</FormHelperText>
88
+ </FormControl>
89
+ ```
90
+
91
+ ```tsx
92
+ <FormControl error>
93
+ <FormLabel>Email</FormLabel>
94
+ <Input placeholder="email@example.com" value="invalid-email" />
95
+ <FormHelperText>Please enter a valid email address.</FormHelperText>
96
+ </FormControl>
97
+ ```
98
+
99
+ ## Disabled State
100
+
101
+ Set `disabled` to disable all child form elements at once.
102
+
103
+ ```tsx
104
+ <FormControl disabled>
105
+ <FormLabel>Name</FormLabel>
106
+ <Input placeholder="Enter name" value="John Doe" />
107
+ <FormHelperText>This field is disabled.</FormHelperText>
108
+ </FormControl>
109
+ ```
110
+
111
+ ```tsx
112
+ <FormControl disabled>
113
+ <FormLabel>Name</FormLabel>
114
+ <Input placeholder="Enter name" value="John Doe" />
115
+ <FormHelperText>This field is disabled.</FormHelperText>
116
+ </FormControl>
117
+ ```
118
+
119
+ ## Required Field
120
+
121
+ Set `required` to add an asterisk (\*) to the label and mark the field as required.
122
+
123
+ ```tsx
124
+ <FormControl required>
125
+ <FormLabel>Full Name</FormLabel>
126
+ <Input placeholder="Enter your full name" />
127
+ <FormHelperText>This field is required.</FormHelperText>
128
+ </FormControl>
129
+ ```
130
+
131
+ ```tsx
132
+ <FormControl required>
133
+ <FormLabel>Full Name</FormLabel>
134
+ <Input placeholder="Enter your full name" />
135
+ </FormControl>
136
+ ```
137
+
138
+ ## Sizes
139
+
140
+ FormControl supports `sm`, `md`, and `lg` sizes. The size is inherited by child components.
141
+
142
+ ```tsx
143
+ <Stack gap={3}>
144
+ <FormControl size="sm">
145
+ <FormLabel>Small</FormLabel>
146
+ <Input placeholder="Small input" />
147
+ </FormControl>
148
+ <FormControl size="md">
149
+ <FormLabel>Medium</FormLabel>
150
+ <Input placeholder="Medium input" />
151
+ </FormControl>
152
+ <FormControl size="lg">
153
+ <FormLabel>Large</FormLabel>
154
+ <Input placeholder="Large input" />
155
+ </FormControl>
156
+ </Stack>
157
+ ```
158
+
159
+ ## Horizontal Layout
160
+
161
+ Use `orientation="horizontal"` for inline form controls, such as Switch or Checkbox toggles.
162
+
163
+ ```tsx
164
+ <FormControl orientation="horizontal" sx={{
165
+ gap: 2
166
+ }}>
167
+ <FormLabel>Subscribe</FormLabel>
168
+ <Switch />
169
+ </FormControl>
170
+ ```
171
+
172
+ ```tsx
173
+ <FormControl orientation="horizontal" sx={{ gap: 2 }}>
174
+ <FormLabel>Subscribe</FormLabel>
175
+ <Switch />
176
+ </FormControl>
177
+ ```
178
+
179
+ ## Form Example
180
+
181
+ A complete form demonstrating FormControl with multiple input types.
182
+
183
+ ```tsx
184
+ <Stack gap={2} sx={{
185
+ maxWidth: 400
186
+ }}>
187
+ <FormControl required>
188
+ <FormLabel>Name</FormLabel>
189
+ <Input placeholder="Enter your name" />
190
+ </FormControl>
191
+ <FormControl required>
192
+ <FormLabel>Email</FormLabel>
193
+ <Input type="email" placeholder="email@example.com" />
194
+ <FormHelperText>We will never share your email.</FormHelperText>
195
+ </FormControl>
196
+ <FormControl>
197
+ <FormLabel>Role</FormLabel>
198
+ <Select placeholder="Select a role">
199
+ <Option value="admin">Admin</Option>
200
+ <Option value="editor">Editor</Option>
201
+ <Option value="viewer">Viewer</Option>
202
+ </Select>
203
+ </FormControl>
204
+ <FormControl>
205
+ <FormLabel>Bio</FormLabel>
206
+ <Textarea placeholder="Tell us about yourself…" minRows={3} />
207
+ <FormHelperText>Maximum 500 characters.</FormHelperText>
208
+ </FormControl>
209
+ </Stack>
210
+ ```
211
+
212
+ ## FormLabel
213
+
214
+ FormLabel renders a `<label>` element associated with its sibling input. It automatically displays an asterisk when the parent FormControl has `required` set.
215
+
216
+ ```tsx
217
+ <FormControl required>
218
+ <FormLabel>Email</FormLabel>
219
+ <Input />
220
+ </FormControl>
221
+ ```
222
+
223
+ ## FormHelperText
224
+
225
+ FormHelperText provides supplementary guidance below the input. It automatically switches to the error color when the parent FormControl has `error` set.
226
+
227
+ ```tsx
228
+ <FormControl error>
229
+ <FormLabel>Password</FormLabel>
230
+ <Input type="password" />
231
+ <FormHelperText>Password must be at least 8 characters.</FormHelperText>
232
+ </FormControl>
233
+ ```
234
+
235
+ ## Common Use Cases
236
+
237
+ ### Registration Form
238
+
239
+ ```tsx
240
+ function RegistrationForm() {
241
+ const [errors, setErrors] = React.useState({});
242
+
243
+ return (
244
+ <Stack gap={2} component="form">
245
+ <FormControl required error={!!errors.name}>
246
+ <FormLabel>Name</FormLabel>
247
+ <Input placeholder="Enter your name" />
248
+ {errors.name && <FormHelperText>{errors.name}</FormHelperText>}
249
+ </FormControl>
250
+
251
+ <FormControl required error={!!errors.email}>
252
+ <FormLabel>Email</FormLabel>
253
+ <Input type="email" placeholder="email@example.com" />
254
+ {errors.email && <FormHelperText>{errors.email}</FormHelperText>}
255
+ </FormControl>
256
+
257
+ <FormControl required error={!!errors.password}>
258
+ <FormLabel>Password</FormLabel>
259
+ <Input type="password" placeholder="Enter password" />
260
+ <FormHelperText>
261
+ {errors.password || 'Must be at least 8 characters.'}
262
+ </FormHelperText>
263
+ </FormControl>
264
+
265
+ <FormControl orientation="horizontal">
266
+ <Checkbox label="I agree to the terms and conditions" />
267
+ </FormControl>
268
+ </Stack>
269
+ );
270
+ }
271
+ ```
272
+
273
+ ### Settings Form with Mixed Controls
274
+
275
+ ```tsx
276
+ function SettingsForm() {
277
+ return (
278
+ <Stack gap={2}>
279
+ <FormControl orientation="horizontal" sx={{ justifyContent: 'space-between' }}>
280
+ <FormLabel>Email notifications</FormLabel>
281
+ <Switch />
282
+ </FormControl>
283
+
284
+ <FormControl>
285
+ <FormLabel>Language</FormLabel>
286
+ <Select defaultValue="en">
287
+ <Option value="en">English</Option>
288
+ <Option value="ko">한국어</Option>
289
+ </Select>
290
+ </FormControl>
291
+
292
+ <FormControl>
293
+ <FormLabel>Notes</FormLabel>
294
+ <Textarea minRows={3} placeholder="Additional notes…" />
295
+ <FormHelperText>Optional</FormHelperText>
296
+ </FormControl>
297
+ </Stack>
298
+ );
299
+ }
300
+ ```
301
+
302
+ > **Tip: Use built-in form props instead**
303
+ >
304
+ > Input, Select, Textarea, DatePicker 등 Input 계열 컴포넌트는 `label`, `helperText` prop을 자체적으로 지원합니다.
305
+ > 간단한 form 필드에는 각 컴포넌트의 내장 prop을 사용하는 것이 더 간결합니다.
306
+ >
307
+ > ```tsx
308
+ > // ✅ Simpler: built-in props
309
+ > <Input label="Username" helperText="Choose a unique username." />
310
+ >
311
+ > // ⬆️ Equivalent to:
312
+ > <FormControl>
313
+ > <FormLabel>Username</FormLabel>
314
+ > <Input placeholder="Enter username" />
315
+ > <FormHelperText>Choose a unique username.</FormHelperText>
316
+ > </FormControl>
317
+ > ```
318
+ >
319
+ > FormControl is most useful when you need to compose multiple elements, share state across siblings, or use horizontal orientation.
320
+
321
+ ## Best Practices
322
+
323
+ 1. **Always pair with FormLabel**: Every form field should have a label for accessibility. Use FormLabel inside FormControl.
324
+
325
+ ```tsx
326
+ // ✅ Accessible — label is associated with input
327
+ <FormControl>
328
+ <FormLabel>Email</FormLabel>
329
+ <Input />
330
+ </FormControl>
331
+
332
+ // ❌ No label — screen readers cannot identify the input
333
+ <FormControl>
334
+ <Input placeholder="Email" />
335
+ </FormControl>
336
+ ```
337
+
338
+ 2. **Use `error` prop on FormControl, not children**: Set error state on FormControl so all children react consistently.
339
+
340
+ ```tsx
341
+ // ✅ Error propagated from FormControl
342
+ <FormControl error>
343
+ <FormLabel>Email</FormLabel>
344
+ <Input />
345
+ <FormHelperText>Invalid email</FormHelperText>
346
+ </FormControl>
347
+
348
+ // ❌ Inconsistent — only Input shows error
349
+ <FormControl>
350
+ <FormLabel>Email</FormLabel>
351
+ <Input error />
352
+ <FormHelperText>Invalid email</FormHelperText>
353
+ </FormControl>
354
+ ```
355
+
356
+ 3. **Use consistent sizing**: Set `size` on FormControl to ensure all children (label, input, helper text) are proportionally sized.
357
+
358
+ 4. **Mark required fields**: Use the `required` prop to automatically add visual indicators and `aria-required` attributes.
359
+
360
+ 5. **Provide helpful error messages**: When using the error state, always include a FormHelperText explaining what went wrong and how to fix it.
361
+
362
+ ## Accessibility
363
+
364
+ - FormControl automatically associates FormLabel with the input using `htmlFor` and `id`.
365
+ - The `required` prop adds `aria-required="true"` to the input and an asterisk to the label.
366
+ - The `error` prop adds `aria-invalid="true"` to the input.
367
+ - FormHelperText is linked to the input via `aria-describedby` so screen readers announce it.
368
+ - Use the `disabled` prop on FormControl to set `aria-disabled` on child elements.