@ceed/ads 1.23.3 → 1.23.5
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.
- package/dist/components/data-display/Badge.md +71 -39
- package/dist/components/data-display/InfoSign.md +74 -98
- package/dist/components/data-display/Typography.md +310 -61
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/inputs/ButtonGroup.md +115 -106
- package/dist/components/inputs/Calendar.md +98 -459
- package/dist/components/inputs/CurrencyInput.md +181 -8
- package/dist/components/inputs/DatePicker.md +108 -436
- package/dist/components/inputs/DateRangePicker.md +130 -496
- package/dist/components/inputs/FilterMenu.md +169 -19
- package/dist/components/inputs/FilterableCheckboxGroup.md +119 -24
- package/dist/components/inputs/FormControl.md +361 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/MonthPicker.md +95 -427
- package/dist/components/inputs/MonthRangePicker.md +89 -471
- package/dist/components/inputs/PercentageInput.md +183 -19
- package/dist/components/inputs/RadioButton.md +163 -35
- package/dist/components/inputs/RadioList.md +241 -0
- package/dist/components/inputs/RadioTileGroup.md +146 -62
- package/dist/components/inputs/Select.md +219 -328
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +136 -376
- package/dist/components/inputs/Textarea.md +209 -11
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +3 -0
- package/dist/components/navigation/Breadcrumbs.md +80 -322
- package/dist/components/navigation/Dropdown.md +92 -221
- package/dist/components/navigation/IconMenuButton.md +40 -502
- package/dist/components/navigation/InsetDrawer.md +68 -738
- package/dist/components/navigation/Link.md +39 -298
- package/dist/components/navigation/Menu.md +92 -285
- package/dist/components/navigation/MenuButton.md +55 -448
- package/dist/components/navigation/Pagination.md +47 -338
- package/dist/components/navigation/ProfileMenu.md +45 -268
- package/dist/components/navigation/Stepper.md +160 -28
- package/dist/components/navigation/Tabs.md +57 -316
- package/dist/components/surfaces/Sheet.md +150 -333
- package/dist/guides/ThemeProvider.md +116 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/llms.txt +8 -0
- package/package.json +1 -1
|
@@ -33,20 +33,110 @@ function MyComponent() {
|
|
|
33
33
|
|
|
34
34
|
## Typography Levels
|
|
35
35
|
|
|
36
|
+
### Overview
|
|
37
|
+
|
|
38
|
+
Typography levels are divided into three groups: **Headings**, **Titles**, and **Body**. The default level is `body-md`.
|
|
39
|
+
|
|
40
|
+
- **Headings** (`h1`–`h4`): Used for page and section headings. Uses the display font family (Inter).
|
|
41
|
+
- **Titles** (`title-lg`, `title-md`, `title-sm`): Used for UI labels, card titles, and emphasized text. Uses the body font family (Inter).
|
|
42
|
+
- **Body** (`body-lg`, `body-md`, `body-sm`, `body-xs`): Used for readable content and descriptions. Uses the body font family (Inter).
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<>
|
|
46
|
+
<Stack direction="row" spacing={2}>
|
|
47
|
+
<Typography level="h1">h1</Typography>
|
|
48
|
+
<Typography {...args} level="h1" />
|
|
49
|
+
</Stack>
|
|
50
|
+
<Stack direction="row" spacing={2}>
|
|
51
|
+
<Typography level="h2">h2</Typography>
|
|
52
|
+
<Typography {...args} level="h2" />
|
|
53
|
+
</Stack>
|
|
54
|
+
<Stack direction="row" spacing={2}>
|
|
55
|
+
<Typography level="h3">h3</Typography>
|
|
56
|
+
<Typography {...args} level="h3" />
|
|
57
|
+
</Stack>
|
|
58
|
+
<Stack direction="row" spacing={2}>
|
|
59
|
+
<Typography level="h4">h4</Typography>
|
|
60
|
+
<Typography {...args} level="h4" />
|
|
61
|
+
</Stack>
|
|
62
|
+
<Stack direction="row" spacing={2}>
|
|
63
|
+
<Typography level="title-lg">title-lg</Typography>
|
|
64
|
+
<Typography {...args} level="title-lg" />
|
|
65
|
+
</Stack>
|
|
66
|
+
<Stack direction="row" spacing={2}>
|
|
67
|
+
<Typography level="title-md">title-md</Typography>
|
|
68
|
+
<Typography {...args} level="title-md" />
|
|
69
|
+
</Stack>
|
|
70
|
+
<Stack direction="row" spacing={2}>
|
|
71
|
+
<Typography level="title-sm">title-sm</Typography>
|
|
72
|
+
<Typography {...args} level="title-sm" />
|
|
73
|
+
</Stack>
|
|
74
|
+
<Stack direction="row" spacing={2}>
|
|
75
|
+
<Typography level="body-lg">body-lg</Typography>
|
|
76
|
+
<Typography {...args} level="body-lg" />
|
|
77
|
+
</Stack>
|
|
78
|
+
<Stack direction="row" spacing={2}>
|
|
79
|
+
<Typography level="body-md">body-md</Typography>
|
|
80
|
+
<Typography {...args} level="body-md" />
|
|
81
|
+
</Stack>
|
|
82
|
+
<Stack direction="row" spacing={2}>
|
|
83
|
+
<Typography level="body-sm">body-sm</Typography>
|
|
84
|
+
<Typography {...args} level="body-sm" />
|
|
85
|
+
</Stack>
|
|
86
|
+
<Stack direction="row" spacing={2}>
|
|
87
|
+
<Typography level="body-xs">body-xs</Typography>
|
|
88
|
+
<Typography {...args} level="body-xs" />
|
|
89
|
+
</Stack>
|
|
90
|
+
</>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Style Reference
|
|
94
|
+
|
|
95
|
+
| Level | Font Family | Font Size | Font Weight | Line Height | Letter Spacing | Default Color | HTML Tag |
|
|
96
|
+
| -------- | --------------- | --------------- | -------------- | ----------- | -------------- | -------------- | -------- |
|
|
97
|
+
| h1 | display (Inter) | 2.25rem (36px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h1>` |
|
|
98
|
+
| h2 | display (Inter) | 1.875rem (30px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h2>` |
|
|
99
|
+
| h3 | display (Inter) | 1.5rem (24px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<h3>` |
|
|
100
|
+
| h4 | display (Inter) | 1.25rem (20px) | 600 (SemiBold) | 1.5 | -0.025em | text.primary | `<h4>` |
|
|
101
|
+
| title-lg | body (Inter) | 1.125rem (18px) | 600 (SemiBold) | 1.333 | - | text.primary | `<p>` |
|
|
102
|
+
| title-md | body (Inter) | 1rem (16px) | 500 (Medium) | 1.5 | - | text.primary | `<p>` |
|
|
103
|
+
| title-sm | body (Inter) | 0.875rem (14px) | 500 (Medium) | 1.429 | - | text.primary | `<p>` |
|
|
104
|
+
| body-lg | body (Inter) | 1.125rem (18px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
105
|
+
| body-md | body (Inter) | 1rem (16px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
106
|
+
| body-sm | body (Inter) | 0.875rem (14px) | inherit | 1.5 | - | text.tertiary | `<p>` |
|
|
107
|
+
| body-xs | body (Inter) | 0.75rem (12px) | 500 (Medium) | 1.5 | - | text.tertiary | `<span>` |
|
|
108
|
+
|
|
36
109
|
### Headings
|
|
37
110
|
|
|
38
|
-
|
|
111
|
+
Heading levels define page structure and hierarchy. They use the display font family with heavier weights for visual prominence.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<>
|
|
115
|
+
<Typography level="h1">h1 - Main page heading</Typography>
|
|
116
|
+
<Typography level="h2">h2 - Section heading</Typography>
|
|
117
|
+
<Typography level="h3">h3 - Subsection heading</Typography>
|
|
118
|
+
<Typography level="h4">h4 - Detail heading</Typography>
|
|
119
|
+
</>
|
|
120
|
+
```
|
|
39
121
|
|
|
40
122
|
```tsx
|
|
41
123
|
<Typography level="h1">H1 - Main page heading</Typography>
|
|
42
124
|
<Typography level="h2">H2 - Section heading</Typography>
|
|
43
125
|
<Typography level="h3">H3 - Subsection heading</Typography>
|
|
44
|
-
<Typography level="h4">H4 -
|
|
126
|
+
<Typography level="h4">H4 - Detail heading</Typography>
|
|
45
127
|
```
|
|
46
128
|
|
|
47
129
|
### Titles
|
|
48
130
|
|
|
49
|
-
|
|
131
|
+
Title levels are used for UI labels, card titles, and other emphasized text that is not a document heading.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<>
|
|
135
|
+
<Typography level="title-lg">title-lg - Large title</Typography>
|
|
136
|
+
<Typography level="title-md">title-md - Medium title</Typography>
|
|
137
|
+
<Typography level="title-sm">title-sm - Small title</Typography>
|
|
138
|
+
</>
|
|
139
|
+
```
|
|
50
140
|
|
|
51
141
|
```tsx
|
|
52
142
|
<Typography level="title-lg">Large Title</Typography>
|
|
@@ -56,7 +146,16 @@ Used for important titles or emphasized text.
|
|
|
56
146
|
|
|
57
147
|
### Body Text
|
|
58
148
|
|
|
59
|
-
|
|
149
|
+
Body levels are used for readable content and descriptions. The default level `body-md` is suitable for most body text. Use `body-xs` sparingly for auxiliary information like timestamps or counters.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<>
|
|
153
|
+
<Typography level="body-lg">body-lg - Large body text</Typography>
|
|
154
|
+
<Typography level="body-md">body-md - Regular body text</Typography>
|
|
155
|
+
<Typography level="body-sm">body-sm - Small body text</Typography>
|
|
156
|
+
<Typography level="body-xs">body-xs - Extra small text</Typography>
|
|
157
|
+
</>
|
|
158
|
+
```
|
|
60
159
|
|
|
61
160
|
```tsx
|
|
62
161
|
<Typography level="body-lg">Large body text</Typography>
|
|
@@ -65,6 +164,194 @@ Levels for body text. Use these for most readable content.
|
|
|
65
164
|
<Typography level="body-xs">Extra small text</Typography>
|
|
66
165
|
```
|
|
67
166
|
|
|
167
|
+
## Design Token Reference
|
|
168
|
+
|
|
169
|
+
### Font Size Scale
|
|
170
|
+
|
|
171
|
+
| Token | Value |
|
|
172
|
+
| ----- | --------------- |
|
|
173
|
+
| xs | 0.75rem (12px) |
|
|
174
|
+
| sm | 0.875rem (14px) |
|
|
175
|
+
| md | 1rem (16px) |
|
|
176
|
+
| lg | 1.125rem (18px) |
|
|
177
|
+
| xl | 1.25rem (20px) |
|
|
178
|
+
| xl2 | 1.5rem (24px) |
|
|
179
|
+
| xl3 | 1.875rem (30px) |
|
|
180
|
+
| xl4 | 2.25rem (36px) |
|
|
181
|
+
|
|
182
|
+
### Font Weight Scale
|
|
183
|
+
|
|
184
|
+
| Token | Value |
|
|
185
|
+
| ----- | -------------- |
|
|
186
|
+
| sm | 300 (Light) |
|
|
187
|
+
| md | 500 (Medium) |
|
|
188
|
+
| lg | 600 (SemiBold) |
|
|
189
|
+
| xl | 700 (Bold) |
|
|
190
|
+
|
|
191
|
+
### Line Height Scale
|
|
192
|
+
|
|
193
|
+
| Token | Value |
|
|
194
|
+
| ----- | ----- |
|
|
195
|
+
| xs | 1.333 |
|
|
196
|
+
| sm | 1.429 |
|
|
197
|
+
| md | 1.5 |
|
|
198
|
+
| lg | 1.556 |
|
|
199
|
+
| xl | 1.667 |
|
|
200
|
+
|
|
201
|
+
### Font Families
|
|
202
|
+
|
|
203
|
+
- **body**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
204
|
+
- **display**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
205
|
+
- **code**: `"Source Code Pro"`, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
|
|
206
|
+
|
|
207
|
+
## Colors
|
|
208
|
+
|
|
209
|
+
Typography supports five semantic colors via the `color` prop. Use `textColor` to apply any palette color directly.
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
<>
|
|
213
|
+
<Typography color="primary">Primary color</Typography>
|
|
214
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
215
|
+
<Typography color="danger">Danger color</Typography>
|
|
216
|
+
<Typography color="success">Success color</Typography>
|
|
217
|
+
<Typography color="warning">Warning color</Typography>
|
|
218
|
+
</>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
<Typography color="primary">Primary color</Typography>
|
|
223
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
224
|
+
<Typography color="danger">Danger color</Typography>
|
|
225
|
+
<Typography color="success">Success color</Typography>
|
|
226
|
+
<Typography color="warning">Warning color</Typography>
|
|
227
|
+
|
|
228
|
+
{/* Use textColor for specific palette values */}
|
|
229
|
+
<Typography textColor="neutral.600">Custom palette color</Typography>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Component Prop
|
|
233
|
+
|
|
234
|
+
Use the `component` prop to render Typography as a different HTML element or React component. Each level has a default HTML tag mapping shown below.
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
<>
|
|
238
|
+
<Typography level="h1" component="h2">
|
|
239
|
+
h1 style rendered as h2 tag
|
|
240
|
+
</Typography>
|
|
241
|
+
<Typography level="body-md" component="span">
|
|
242
|
+
body-md rendered as span
|
|
243
|
+
</Typography>
|
|
244
|
+
<Typography level="title-md" component="label">
|
|
245
|
+
title-md rendered as label
|
|
246
|
+
</Typography>
|
|
247
|
+
</>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
<Typography level="h1" component="h2">
|
|
252
|
+
h1 style rendered as an h2 tag
|
|
253
|
+
</Typography>
|
|
254
|
+
|
|
255
|
+
<Typography level="body-md" component="span">
|
|
256
|
+
Inline text
|
|
257
|
+
</Typography>
|
|
258
|
+
|
|
259
|
+
<Typography level="title-md" component="label">
|
|
260
|
+
Rendered as a label element
|
|
261
|
+
</Typography>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Default HTML tag mapping:**
|
|
265
|
+
|
|
266
|
+
| Level | Default HTML Tag |
|
|
267
|
+
| -------- | ---------------- |
|
|
268
|
+
| h1 | `<h1>` |
|
|
269
|
+
| h2 | `<h2>` |
|
|
270
|
+
| h3 | `<h3>` |
|
|
271
|
+
| h4 | `<h4>` |
|
|
272
|
+
| title-lg | `<p>` |
|
|
273
|
+
| title-md | `<p>` |
|
|
274
|
+
| title-sm | `<p>` |
|
|
275
|
+
| body-lg | `<p>` |
|
|
276
|
+
| body-md | `<p>` |
|
|
277
|
+
| body-sm | `<p>` |
|
|
278
|
+
| body-xs | `<span>` |
|
|
279
|
+
|
|
280
|
+
## Decorators
|
|
281
|
+
|
|
282
|
+
Use `startDecorator` and `endDecorator` to add icons or other elements before or after the text.
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
<>
|
|
286
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
287
|
+
Text with start decorator
|
|
288
|
+
</Typography>
|
|
289
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
290
|
+
Text with end decorator
|
|
291
|
+
</Typography>
|
|
292
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
293
|
+
Text with both decorators
|
|
294
|
+
</Typography>
|
|
295
|
+
</>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
import InfoOutlined from '@mui/icons-material/InfoOutlined';
|
|
300
|
+
import ArrowForward from '@mui/icons-material/ArrowForward';
|
|
301
|
+
|
|
302
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
303
|
+
Text with start decorator
|
|
304
|
+
</Typography>
|
|
305
|
+
|
|
306
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
307
|
+
Text with end decorator
|
|
308
|
+
</Typography>
|
|
309
|
+
|
|
310
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
311
|
+
Text with both decorators
|
|
312
|
+
</Typography>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Text Overflow (noWrap)
|
|
316
|
+
|
|
317
|
+
Use the `noWrap` prop to truncate overflowing text with an ellipsis. Pair it with a `maxWidth` to constrain the text width.
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
<Typography noWrap sx={{
|
|
321
|
+
maxWidth: 200
|
|
322
|
+
}}>
|
|
323
|
+
This is a long text that will be truncated with an ellipsis when it
|
|
324
|
+
exceeds the maximum width of the container.
|
|
325
|
+
</Typography>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
<Typography noWrap sx={{ maxWidth: 200 }}>
|
|
330
|
+
This is a long text that will be truncated with an ellipsis when it exceeds
|
|
331
|
+
the maximum width.
|
|
332
|
+
</Typography>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Responsive Typography
|
|
336
|
+
|
|
337
|
+
You can pass a responsive object to the `level` prop, or use `sx` to set responsive font sizes.
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
{/* Responsive level */}
|
|
341
|
+
<Typography level={{ xs: 'h3', sm: 'h2', md: 'h1' }}>
|
|
342
|
+
Responsive Heading
|
|
343
|
+
</Typography>
|
|
344
|
+
|
|
345
|
+
{/* Responsive font size via sx */}
|
|
346
|
+
<Typography
|
|
347
|
+
sx={{
|
|
348
|
+
fontSize: { xs: '1rem', sm: '1.25rem', md: '1.5rem' },
|
|
349
|
+
}}
|
|
350
|
+
>
|
|
351
|
+
Responsive text
|
|
352
|
+
</Typography>
|
|
353
|
+
```
|
|
354
|
+
|
|
68
355
|
## Common Use Cases
|
|
69
356
|
|
|
70
357
|
### Page Structure
|
|
@@ -197,7 +484,7 @@ function ArticlePage() {
|
|
|
197
484
|
level="body-md"
|
|
198
485
|
sx={{
|
|
199
486
|
textDecoration: item.completed ? 'line-through' : 'none',
|
|
200
|
-
color: item.completed ? 'neutral.500' : 'text.primary'
|
|
487
|
+
color: item.completed ? 'neutral.500' : 'text.primary',
|
|
201
488
|
}}
|
|
202
489
|
>
|
|
203
490
|
{item.text}
|
|
@@ -210,56 +497,9 @@ function ArticlePage() {
|
|
|
210
497
|
</Stack>
|
|
211
498
|
```
|
|
212
499
|
|
|
213
|
-
## Colors
|
|
214
|
-
|
|
215
|
-
Typography supports various colors:
|
|
216
|
-
|
|
217
|
-
```tsx
|
|
218
|
-
<Stack spacing={1}>
|
|
219
|
-
<Typography color="primary">Primary color</Typography>
|
|
220
|
-
<Typography color="neutral">Neutral color</Typography>
|
|
221
|
-
<Typography color="danger">Danger color</Typography>
|
|
222
|
-
<Typography color="success">Success color</Typography>
|
|
223
|
-
<Typography color="warning">Warning color</Typography>
|
|
224
|
-
</Stack>
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Component Prop
|
|
228
|
-
|
|
229
|
-
You can render it as a different HTML element or React component:
|
|
230
|
-
|
|
231
|
-
```tsx
|
|
232
|
-
<Typography level="h1" component="h2">
|
|
233
|
-
h1 style rendered as an h2 tag
|
|
234
|
-
</Typography>
|
|
235
|
-
|
|
236
|
-
<Typography level="body-md" component="span">
|
|
237
|
-
Inline text
|
|
238
|
-
</Typography>
|
|
239
|
-
|
|
240
|
-
<Typography level="title-md" component={Link} href="/page">
|
|
241
|
-
Rendered as a Link component
|
|
242
|
-
</Typography>
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## Responsive Typography
|
|
246
|
-
|
|
247
|
-
You can use responsive levels:
|
|
248
|
-
|
|
249
|
-
```tsx
|
|
250
|
-
<Typography
|
|
251
|
-
level={{ xs: 'h3', sm: 'h2', md: 'h1' }}
|
|
252
|
-
sx={{
|
|
253
|
-
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.5rem' }
|
|
254
|
-
}}
|
|
255
|
-
>
|
|
256
|
-
Responsive Heading
|
|
257
|
-
</Typography>
|
|
258
|
-
```
|
|
259
|
-
|
|
260
500
|
## Best Practices
|
|
261
501
|
|
|
262
|
-
1. **Semantic Structure**: Use heading levels in order to create a clear document
|
|
502
|
+
1. **Semantic Structure**: Use heading levels in order (`h1` → `h2` → `h3`) to create a clear document hierarchy.
|
|
263
503
|
|
|
264
504
|
```tsx
|
|
265
505
|
// ✅ Correct order
|
|
@@ -267,22 +507,31 @@ You can use responsive levels:
|
|
|
267
507
|
<Typography level="h2">Section heading</Typography>
|
|
268
508
|
<Typography level="h3">Subsection</Typography>
|
|
269
509
|
|
|
270
|
-
// ❌ Incorrect order
|
|
510
|
+
// ❌ Incorrect order — skipping h2
|
|
271
511
|
<Typography level="h1">Main heading</Typography>
|
|
272
512
|
<Typography level="h3">Section heading</Typography>
|
|
273
513
|
```
|
|
274
514
|
|
|
275
|
-
2. **Consistency**: Use the same level for text serving the same purpose.
|
|
515
|
+
2. **Consistency**: Use the same level for text serving the same purpose across the application.
|
|
276
516
|
|
|
277
517
|
3. **Readability**: Provide proper line spacing and paragraph separation for body text.
|
|
278
518
|
|
|
279
519
|
4. **Color Contrast**: Maintain sufficient color contrast to ensure accessibility.
|
|
280
520
|
|
|
281
|
-
|
|
521
|
+
5. **Level Selection Guide**:
|
|
522
|
+
- **Headings** (`h1`–`h4`): Use for document structure and section titles.
|
|
523
|
+
- **Titles** (`title-lg/md/sm`): Use for UI labels, card headers, and emphasized text.
|
|
524
|
+
- **Body** (`body-lg/md/sm/xs`): Use for content, descriptions, and supporting text.
|
|
282
525
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
526
|
+
6. **Avoid inline style overrides**: Prefer the `level` prop over `sx` for font sizing. Use `level` for consistent design tokens.
|
|
527
|
+
|
|
528
|
+
7. **Use `textColor` for custom colors**: When the five semantic colors are insufficient, use `textColor` to apply any palette value directly.
|
|
529
|
+
|
|
530
|
+
8. **Use `body-xs` sparingly**: Reserve `body-xs` (12px) for auxiliary information such as timestamps, counters, and footnotes — not for primary content.
|
|
531
|
+
|
|
532
|
+
## Accessibility
|
|
287
533
|
|
|
288
|
-
|
|
534
|
+
- Use sequential heading levels (`h1` → `h2` → `h3`). Do not skip levels.
|
|
535
|
+
- Use the `component` prop to separate visual style from semantic meaning (e.g., `level="h1" component="h2"` when you need h1 styling but h2 semantics).
|
|
536
|
+
- Avoid using `body-xs` (12px) for essential content — the small size may be difficult to read.
|
|
537
|
+
- Maintain sufficient color contrast ratios (WCAG AA: 4.5:1 for normal text, 3:1 for large text).
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# CircularProgress
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The CircularProgress component displays a circular loading indicator. It is based on Joy UI's CircularProgress and supports both indeterminate (spinning) and determinate (progress percentage) modes. Use it to provide visual feedback during asynchronous operations like data fetching, file uploads, or form submissions.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<CircularProgress />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Field | Description | Default |
|
|
12
|
+
| ----------- | ----------- | ------- |
|
|
13
|
+
| size | — | — |
|
|
14
|
+
| color | — | — |
|
|
15
|
+
| variant | — | — |
|
|
16
|
+
| value | — | — |
|
|
17
|
+
| determinate | — | — |
|
|
18
|
+
| thickness | — | — |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { CircularProgress } from '@ceed/ads';
|
|
24
|
+
|
|
25
|
+
function MyComponent() {
|
|
26
|
+
return <CircularProgress />;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Sizes
|
|
31
|
+
|
|
32
|
+
CircularProgress supports three sizes: `sm`, `md` (default), and `lg`.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
<>
|
|
36
|
+
<CircularProgress size="sm" />
|
|
37
|
+
<CircularProgress size="md" />
|
|
38
|
+
<CircularProgress size="lg" />
|
|
39
|
+
</>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<CircularProgress size="sm" />
|
|
44
|
+
<CircularProgress size="md" />
|
|
45
|
+
<CircularProgress size="lg" />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Colors
|
|
49
|
+
|
|
50
|
+
Five semantic colors are available via the `color` prop. The default is `primary`.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<>
|
|
54
|
+
<CircularProgress color="primary" />
|
|
55
|
+
<CircularProgress color="neutral" />
|
|
56
|
+
<CircularProgress color="danger" />
|
|
57
|
+
<CircularProgress color="success" />
|
|
58
|
+
<CircularProgress color="warning" />
|
|
59
|
+
</>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<CircularProgress color="primary" />
|
|
64
|
+
<CircularProgress color="neutral" />
|
|
65
|
+
<CircularProgress color="danger" />
|
|
66
|
+
<CircularProgress color="success" />
|
|
67
|
+
<CircularProgress color="warning" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Variants
|
|
71
|
+
|
|
72
|
+
Four visual variants are supported: `solid`, `soft` (default), `outlined`, and `plain`.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<>
|
|
76
|
+
<CircularProgress variant="solid" />
|
|
77
|
+
<CircularProgress variant="soft" />
|
|
78
|
+
<CircularProgress variant="outlined" />
|
|
79
|
+
<CircularProgress variant="plain" />
|
|
80
|
+
</>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<CircularProgress variant="solid" />
|
|
85
|
+
<CircularProgress variant="soft" />
|
|
86
|
+
<CircularProgress variant="outlined" />
|
|
87
|
+
<CircularProgress variant="plain" />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Determinate Mode
|
|
91
|
+
|
|
92
|
+
Set `determinate` to `true` and provide a `value` (0–100) to display specific progress.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<>
|
|
96
|
+
<CircularProgress determinate value={25} />
|
|
97
|
+
<CircularProgress determinate value={50} />
|
|
98
|
+
<CircularProgress determinate value={75} />
|
|
99
|
+
<CircularProgress determinate value={100} />
|
|
100
|
+
</>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<CircularProgress determinate value={25} />
|
|
105
|
+
<CircularProgress determinate value={50} />
|
|
106
|
+
<CircularProgress determinate value={75} />
|
|
107
|
+
<CircularProgress determinate value={100} />
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## With Label
|
|
111
|
+
|
|
112
|
+
Pass children to display a label inside the progress ring. This is useful for showing the current percentage.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<CircularProgress determinate value={66}>
|
|
116
|
+
<Typography level="body-xs">66%</Typography>
|
|
117
|
+
</CircularProgress>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<CircularProgress determinate value={66}>
|
|
122
|
+
<Typography level="body-xs">66%</Typography>
|
|
123
|
+
</CircularProgress>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## In Button
|
|
127
|
+
|
|
128
|
+
Use CircularProgress inside a Button to indicate a loading state.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
<>
|
|
132
|
+
<Button startDecorator={<CircularProgress variant="solid" size="sm" />}>
|
|
133
|
+
Loading…
|
|
134
|
+
</Button>
|
|
135
|
+
<Button disabled>
|
|
136
|
+
<CircularProgress variant="soft" size="sm" />
|
|
137
|
+
</Button>
|
|
138
|
+
</>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<Button startDecorator={<CircularProgress variant="solid" size="sm" />}>
|
|
143
|
+
Loading…
|
|
144
|
+
</Button>
|
|
145
|
+
|
|
146
|
+
<Button disabled>
|
|
147
|
+
<CircularProgress variant="soft" size="sm" />
|
|
148
|
+
</Button>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Thickness
|
|
152
|
+
|
|
153
|
+
Control the stroke thickness of the progress ring with the `thickness` prop.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<>
|
|
157
|
+
<CircularProgress thickness={2} />
|
|
158
|
+
<CircularProgress thickness={4} />
|
|
159
|
+
<CircularProgress thickness={8} />
|
|
160
|
+
</>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
<CircularProgress thickness={2} />
|
|
165
|
+
<CircularProgress thickness={4} />
|
|
166
|
+
<CircularProgress thickness={8} />
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Common Use Cases
|
|
170
|
+
|
|
171
|
+
### Data Fetching Indicator
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
function DataLoader() {
|
|
175
|
+
const [loading, setLoading] = React.useState(true);
|
|
176
|
+
const [data, setData] = React.useState(null);
|
|
177
|
+
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
fetchData().then((result) => {
|
|
180
|
+
setData(result);
|
|
181
|
+
setLoading(false);
|
|
182
|
+
});
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
if (loading) {
|
|
186
|
+
return (
|
|
187
|
+
<Box sx={{ display: 'flex', justifyContent: 'center', py: 4 }}>
|
|
188
|
+
<CircularProgress />
|
|
189
|
+
</Box>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return <DataView data={data} />;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### File Upload Progress
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
function FileUpload({ progress }: { progress: number }) {
|
|
201
|
+
return (
|
|
202
|
+
<Stack direction="row" alignItems="center" spacing={2}>
|
|
203
|
+
<CircularProgress determinate value={progress} size="lg">
|
|
204
|
+
<Typography level="body-xs">{progress}%</Typography>
|
|
205
|
+
</CircularProgress>
|
|
206
|
+
<Typography level="body-md">Uploading file…</Typography>
|
|
207
|
+
</Stack>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Inline Loading Button
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
function SubmitButton({ isSubmitting }: { isSubmitting: boolean }) {
|
|
216
|
+
return (
|
|
217
|
+
<Button
|
|
218
|
+
disabled={isSubmitting}
|
|
219
|
+
startDecorator={
|
|
220
|
+
isSubmitting ? <CircularProgress variant="solid" size="sm" /> : null
|
|
221
|
+
}
|
|
222
|
+
>
|
|
223
|
+
{isSubmitting ? 'Submitting…' : 'Submit'}
|
|
224
|
+
</Button>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Best Practices
|
|
230
|
+
|
|
231
|
+
1. **Use indeterminate for unknown durations**: When you cannot estimate progress, use the default spinning mode. Switch to determinate only when you can track actual progress.
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
// ✅ Unknown duration — indeterminate
|
|
235
|
+
<CircularProgress />
|
|
236
|
+
|
|
237
|
+
// ✅ Known progress — determinate
|
|
238
|
+
<CircularProgress determinate value={uploadProgress} />
|
|
239
|
+
|
|
240
|
+
// ❌ Don't use determinate with a static value for loading
|
|
241
|
+
<CircularProgress determinate value={50} />
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
2. **Size appropriately**: Use `sm` for inline contexts (buttons, table cells), `md` for general use, and `lg` for prominent page-level loading states.
|
|
245
|
+
|
|
246
|
+
3. **Match variant with context**: Use `solid` variant inside solid buttons, and `soft` (default) for standalone usage to maintain visual consistency.
|
|
247
|
+
|
|
248
|
+
4. **Add descriptive text**: Always pair the indicator with text or an `aria-label` so users understand what is loading.
|
|
249
|
+
|
|
250
|
+
5. **Avoid multiple spinners**: Show one loading indicator per distinct loading region. Multiple spinners on a page create visual clutter.
|
|
251
|
+
|
|
252
|
+
## Accessibility
|
|
253
|
+
|
|
254
|
+
- CircularProgress has `role="progressbar"` by default.
|
|
255
|
+
- In determinate mode, `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` are set automatically.
|
|
256
|
+
- Add `aria-label` or nearby descriptive text to explain what is loading (e.g., `aria-label="Loading user data"`).
|
|
257
|
+
- Ensure sufficient color contrast between the progress ring and its background, especially with the `plain` variant.
|