@ceed/ads 1.30.0 → 1.30.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.
- package/dist/Overview.md +5 -5
- package/dist/components/data-display/Avatar.md +85 -74
- package/dist/components/data-display/Badge.md +23 -5
- package/dist/components/data-display/Chip.md +49 -35
- package/dist/components/data-display/DataTable.md +93 -0
- package/dist/components/data-display/InfoSign.md +15 -5
- package/dist/components/data-display/Markdown.md +22 -26
- package/dist/components/data-display/Table.md +63 -53
- package/dist/components/data-display/Tooltip.md +70 -58
- package/dist/components/data-display/Typography.md +28 -11
- package/dist/components/feedback/Alert.md +86 -74
- package/dist/components/feedback/CircularProgress.md +20 -5
- package/dist/components/feedback/Dialog.md +8 -12
- package/dist/components/feedback/Modal.md +12 -16
- package/dist/components/feedback/Skeleton.md +20 -5
- package/dist/components/inputs/Autocomplete.md +8 -10
- package/dist/components/inputs/Button.md +107 -87
- package/dist/components/inputs/ButtonGroup.md +20 -5
- package/dist/components/inputs/Calendar.md +25 -5
- package/dist/components/inputs/Checkbox.md +171 -450
- package/dist/components/inputs/CurrencyInput.md +25 -5
- package/dist/components/inputs/DatePicker.md +39 -5
- package/dist/components/inputs/DateRangePicker.md +29 -5
- package/dist/components/inputs/FilterMenu.md +85 -9
- package/dist/components/inputs/FilterableCheckboxGroup.md +23 -8
- package/dist/components/inputs/FormControl.md +34 -6
- package/dist/components/inputs/IconButton.md +21 -5
- package/dist/components/inputs/Input.md +254 -68
- package/dist/components/inputs/MonthPicker.md +28 -5
- package/dist/components/inputs/MonthRangePicker.md +26 -5
- package/dist/components/inputs/PercentageInput.md +28 -5
- package/dist/components/inputs/RadioButton.md +26 -5
- package/dist/components/inputs/RadioList.md +23 -6
- package/dist/components/inputs/RadioTileGroup.md +40 -8
- package/dist/components/inputs/Select.md +59 -5
- package/dist/components/inputs/Slider.md +26 -5
- package/dist/components/inputs/Switch.md +23 -5
- package/dist/components/inputs/Textarea.md +27 -5
- package/dist/components/inputs/Uploader/Uploader.md +24 -5
- package/dist/components/layout/Box.md +66 -58
- package/dist/components/layout/Container.md +9 -13
- package/dist/components/layout/Grid.md +91 -75
- package/dist/components/layout/Stack.md +85 -70
- package/dist/components/navigation/Breadcrumbs.md +23 -14
- package/dist/components/navigation/Dropdown.md +29 -20
- package/dist/components/navigation/IconMenuButton.md +24 -11
- package/dist/components/navigation/InsetDrawer.md +16 -5
- package/dist/components/navigation/Link.md +30 -14
- package/dist/components/navigation/Menu.md +33 -20
- package/dist/components/navigation/MenuButton.md +26 -12
- package/dist/components/navigation/NavigationGroup.md +7 -11
- package/dist/components/navigation/NavigationItem.md +8 -12
- package/dist/components/navigation/Navigator.md +5 -9
- package/dist/components/navigation/Pagination.md +21 -12
- package/dist/components/navigation/ProfileMenu.md +17 -5
- package/dist/components/navigation/Stepper.md +18 -5
- package/dist/components/navigation/Tabs.md +37 -14
- package/dist/components/surfaces/Accordions.md +12 -16
- package/dist/components/surfaces/Card.md +59 -47
- package/dist/components/surfaces/Divider.md +70 -61
- package/dist/components/surfaces/Sheet.md +18 -5
- package/package.json +1 -1
package/dist/Overview.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# ADS (Admin Design System)
|
|
2
2
|
|
|
3
|
-
ADS
|
|
3
|
+
ADS stands for Admin Design System, a component-based UI design system. It was created to provide a consistent user experience and streamline development and design processes.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This design system is built on [JoyUI](https://mui.com/joy-ui/getting-started/), so you can refer to the [JoyUI](https://mui.com/joy-ui/getting-started/) documentation for most cases, although some components may have different interfaces due to added abstraction layers.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It is named for UIs intended for data-centric administrative dashboards and applications, and it can be applied not only to internal services but also to customer-facing UIs.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Documentation and Guides
|
|
10
10
|
|
|
11
|
-
ADS
|
|
11
|
+
For more information about ADS, refer to the [Design System documentation](https://ecubelabs.atlassian.net/wiki/spaces/HP/pages/3256123430/Design+System).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Avatar
|
|
5
|
+
The Avatar component displays a user's profile image, initials, or icon. It is based on Joy UI Avatar and supports various sizes, colors, and variants. It is used to visually represent individuals, groups, or brands in a user interface.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Avatar alt="User avatar" />
|
|
@@ -25,32 +25,30 @@ import { Avatar } from '@ceed/ads';
|
|
|
25
25
|
function MyComponent() {
|
|
26
26
|
return (
|
|
27
27
|
<div>
|
|
28
|
-
{/*
|
|
28
|
+
{/* Avatar with an image */}
|
|
29
29
|
<Avatar src="/path/to/image.jpg" alt="사용자 이름" />
|
|
30
30
|
|
|
31
|
-
{/*
|
|
31
|
+
{/* Initials avatar */}
|
|
32
32
|
<Avatar>김철수</Avatar>
|
|
33
33
|
|
|
34
|
-
{/*
|
|
34
|
+
{/* Single-character avatar */}
|
|
35
35
|
<Avatar>김</Avatar>
|
|
36
36
|
</div>
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Avatar Basic Usage
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
가장 기본적인 Avatar 사용법입니다.
|
|
43
|
+
The most basic Avatar usage.
|
|
46
44
|
|
|
47
45
|
```tsx
|
|
48
46
|
<Avatar alt="User avatar" />
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
## Avatar With Image
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
An avatar that uses an image.
|
|
54
52
|
|
|
55
53
|
```tsx
|
|
56
54
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -58,9 +56,9 @@ function MyComponent() {
|
|
|
58
56
|
</Stack>
|
|
59
57
|
```
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
## Avatar With Text
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
An avatar that uses text or initials.
|
|
64
62
|
|
|
65
63
|
```tsx
|
|
66
64
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -68,11 +66,9 @@ function MyComponent() {
|
|
|
68
66
|
</Stack>
|
|
69
67
|
```
|
|
70
68
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
### Variants
|
|
69
|
+
## Avatar Variants
|
|
74
70
|
|
|
75
|
-
|
|
71
|
+
You can apply various visual styles.
|
|
76
72
|
|
|
77
73
|
```tsx
|
|
78
74
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -80,14 +76,14 @@ function MyComponent() {
|
|
|
80
76
|
</Stack>
|
|
81
77
|
```
|
|
82
78
|
|
|
83
|
-
- **solid**:
|
|
84
|
-
- **soft**:
|
|
85
|
-
- **outlined**:
|
|
86
|
-
- **plain**:
|
|
79
|
+
- **solid**: A style with a filled background color
|
|
80
|
+
- **soft**: A style with a soft background color
|
|
81
|
+
- **outlined**: A style with only a border
|
|
82
|
+
- **plain**: A minimal style
|
|
87
83
|
|
|
88
|
-
|
|
84
|
+
## Avatar Sizes
|
|
89
85
|
|
|
90
|
-
|
|
86
|
+
You can use avatars in various sizes.
|
|
91
87
|
|
|
92
88
|
```tsx
|
|
93
89
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -97,14 +93,14 @@ function MyComponent() {
|
|
|
97
93
|
</Stack>
|
|
98
94
|
```
|
|
99
95
|
|
|
100
|
-
- **xs**:
|
|
101
|
-
- **sm**:
|
|
102
|
-
- **md**:
|
|
103
|
-
- **lg**:
|
|
96
|
+
- **xs**: Extra small size (16px)
|
|
97
|
+
- **sm**: Small size (24px)
|
|
98
|
+
- **md**: Medium size (32px, default)
|
|
99
|
+
- **lg**: Large size (40px)
|
|
104
100
|
|
|
105
|
-
|
|
101
|
+
## Avatar Colors
|
|
106
102
|
|
|
107
|
-
|
|
103
|
+
You can apply various color themes.
|
|
108
104
|
|
|
109
105
|
```tsx
|
|
110
106
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -112,15 +108,15 @@ function MyComponent() {
|
|
|
112
108
|
</Stack>
|
|
113
109
|
```
|
|
114
110
|
|
|
115
|
-
- **primary**:
|
|
116
|
-
- **neutral**:
|
|
117
|
-
- **danger**:
|
|
118
|
-
- **success**:
|
|
119
|
-
- **warning**:
|
|
111
|
+
- **primary**: Primary brand color
|
|
112
|
+
- **neutral**: Neutral gray tone
|
|
113
|
+
- **danger**: Red for warnings or errors
|
|
114
|
+
- **success**: Green for success
|
|
115
|
+
- **warning**: Orange for caution
|
|
120
116
|
|
|
121
|
-
|
|
117
|
+
## Avatar All Combinations
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
You can review all variant, size, and color combinations.
|
|
124
120
|
|
|
125
121
|
```tsx
|
|
126
122
|
<Stack gap={8}>
|
|
@@ -146,11 +142,9 @@ function MyComponent() {
|
|
|
146
142
|
</Stack>
|
|
147
143
|
```
|
|
148
144
|
|
|
149
|
-
##
|
|
145
|
+
## Avatar User Profile
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
사용자 프로필에서 아바타를 사용하는 경우입니다.
|
|
147
|
+
An example of using an avatar in a user profile.
|
|
154
148
|
|
|
155
149
|
```tsx
|
|
156
150
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -168,9 +162,9 @@ function MyComponent() {
|
|
|
168
162
|
</Stack>
|
|
169
163
|
```
|
|
170
164
|
|
|
171
|
-
|
|
165
|
+
## Avatar Navigation Bar
|
|
172
166
|
|
|
173
|
-
|
|
167
|
+
Used to display the current user in a navigation bar.
|
|
174
168
|
|
|
175
169
|
```tsx
|
|
176
170
|
<Stack direction="row" spacing={2} alignItems="center" sx={{ ml: 'auto' }}>
|
|
@@ -184,9 +178,9 @@ function MyComponent() {
|
|
|
184
178
|
</Stack>
|
|
185
179
|
```
|
|
186
180
|
|
|
187
|
-
|
|
181
|
+
## Avatar Comment System
|
|
188
182
|
|
|
189
|
-
|
|
183
|
+
Used to represent a user in comments or feeds.
|
|
190
184
|
|
|
191
185
|
```tsx
|
|
192
186
|
<Stack direction="row" spacing={2}>
|
|
@@ -207,9 +201,9 @@ function MyComponent() {
|
|
|
207
201
|
</Stack>
|
|
208
202
|
```
|
|
209
203
|
|
|
210
|
-
|
|
204
|
+
## Avatar Team Members
|
|
211
205
|
|
|
212
|
-
|
|
206
|
+
Used to display a list of team members.
|
|
213
207
|
|
|
214
208
|
```tsx
|
|
215
209
|
<Stack spacing={3}>
|
|
@@ -240,9 +234,9 @@ function MyComponent() {
|
|
|
240
234
|
</Stack>
|
|
241
235
|
```
|
|
242
236
|
|
|
243
|
-
|
|
237
|
+
## Avatar Groups
|
|
244
238
|
|
|
245
|
-
|
|
239
|
+
Used to display multiple users as a group.
|
|
246
240
|
|
|
247
241
|
```tsx
|
|
248
242
|
<Stack direction="row" spacing={-1}>
|
|
@@ -255,9 +249,9 @@ function MyComponent() {
|
|
|
255
249
|
</Stack>
|
|
256
250
|
```
|
|
257
251
|
|
|
258
|
-
|
|
252
|
+
## Avatar Status Indicators
|
|
259
253
|
|
|
260
|
-
|
|
254
|
+
Used to display user status alongside the avatar.
|
|
261
255
|
|
|
262
256
|
```tsx
|
|
263
257
|
<Box sx={{ position: 'relative', display: 'inline-block' }}>
|
|
@@ -278,9 +272,9 @@ function MyComponent() {
|
|
|
278
272
|
</Box>
|
|
279
273
|
```
|
|
280
274
|
|
|
281
|
-
|
|
275
|
+
## Avatar Empty State
|
|
282
276
|
|
|
283
|
-
|
|
277
|
+
Used as a placeholder when no data is available.
|
|
284
278
|
|
|
285
279
|
```tsx
|
|
286
280
|
<Stack alignItems="center" spacing={2}>
|
|
@@ -296,9 +290,9 @@ function MyComponent() {
|
|
|
296
290
|
</Stack>
|
|
297
291
|
```
|
|
298
292
|
|
|
299
|
-
|
|
293
|
+
## Avatar List Items
|
|
300
294
|
|
|
301
|
-
|
|
295
|
+
Used to represent users or items in list items.
|
|
302
296
|
|
|
303
297
|
```tsx
|
|
304
298
|
<List>
|
|
@@ -324,7 +318,7 @@ function MyComponent() {
|
|
|
324
318
|
|
|
325
319
|
### Fallback Behavior
|
|
326
320
|
|
|
327
|
-
|
|
321
|
+
If image loading fails, it automatically falls back to initials or an icon.
|
|
328
322
|
|
|
329
323
|
```tsx
|
|
330
324
|
<Avatar
|
|
@@ -339,7 +333,7 @@ function MyComponent() {
|
|
|
339
333
|
|
|
340
334
|
### Loading States
|
|
341
335
|
|
|
342
|
-
|
|
336
|
+
While the image is loading, `children` are shown first, then the image is displayed once loading completes.
|
|
343
337
|
|
|
344
338
|
```tsx
|
|
345
339
|
<Avatar
|
|
@@ -352,13 +346,30 @@ function MyComponent() {
|
|
|
352
346
|
</Avatar>
|
|
353
347
|
```
|
|
354
348
|
|
|
349
|
+
## Props and Customization
|
|
350
|
+
|
|
351
|
+
### Key Props
|
|
352
|
+
|
|
353
|
+
| Prop | Type | Default | Description |
|
|
354
|
+
| ------------ | -------------------------------------------------------------- | --------------- | ----------------------------------------------- |
|
|
355
|
+
| `src` | `string` | - | Image URL for the avatar |
|
|
356
|
+
| `alt` | `string` | - | Alt text for the avatar image |
|
|
357
|
+
| `children` | `ReactNode` | - | Fallback content (text, icon) when no image |
|
|
358
|
+
| `getInitial` | `(name: string) => string` | First character | Custom function to extract initials from a name |
|
|
359
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Avatar size |
|
|
360
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'soft'` | Visual style |
|
|
361
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
362
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
363
|
+
|
|
364
|
+
> **Note**: Avatar also accepts all Joy UI Avatar props and Framer Motion props.
|
|
365
|
+
|
|
355
366
|
## Accessibility
|
|
356
367
|
|
|
357
|
-
Avatar
|
|
368
|
+
Avatar provides the following accessibility features:
|
|
358
369
|
|
|
359
370
|
### Image Alt Text
|
|
360
371
|
|
|
361
|
-
|
|
372
|
+
For image avatars, provide appropriate alt text.
|
|
362
373
|
|
|
363
374
|
```tsx
|
|
364
375
|
<Avatar
|
|
@@ -369,7 +380,7 @@ Avatar 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
369
380
|
|
|
370
381
|
### Semantic Meaning
|
|
371
382
|
|
|
372
|
-
|
|
383
|
+
If the avatar carries meaning rather than serving a purely decorative purpose, provide an appropriate role.
|
|
373
384
|
|
|
374
385
|
```tsx
|
|
375
386
|
<Avatar
|
|
@@ -382,32 +393,32 @@ Avatar 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
382
393
|
|
|
383
394
|
### Color Contrast
|
|
384
395
|
|
|
385
|
-
|
|
396
|
+
For text avatars, maintain sufficient color contrast.
|
|
386
397
|
|
|
387
398
|
```tsx
|
|
388
|
-
//
|
|
399
|
+
// Color combinations that provide good contrast
|
|
389
400
|
<Avatar variant="solid" color="primary">김</Avatar>
|
|
390
401
|
<Avatar variant="soft" color="neutral">이</Avatar>
|
|
391
402
|
```
|
|
392
403
|
|
|
393
404
|
## Best Practices
|
|
394
405
|
|
|
395
|
-
1.
|
|
406
|
+
1. **Choose an appropriate size**: Select a size that fits the usage context.
|
|
396
407
|
|
|
397
408
|
```tsx
|
|
398
|
-
// ✅
|
|
399
|
-
<Avatar size="sm">김</Avatar> //
|
|
400
|
-
<Avatar size="lg">김</Avatar> //
|
|
409
|
+
// ✅ Appropriate size usage
|
|
410
|
+
<Avatar size="sm">김</Avatar> // In a list item
|
|
411
|
+
<Avatar size="lg">김</Avatar> // On a profile page
|
|
401
412
|
|
|
402
|
-
// ❌
|
|
403
|
-
<Avatar size="lg">김</Avatar> //
|
|
413
|
+
// ❌ Inappropriate size usage
|
|
414
|
+
<Avatar size="lg">김</Avatar> // In a navigation bar (too large)
|
|
404
415
|
```
|
|
405
416
|
|
|
406
|
-
2.
|
|
417
|
+
2. **Consistent styling**: Use consistent variants and colors within the same context.
|
|
407
418
|
|
|
408
|
-
3.
|
|
419
|
+
3. **Optimize images**: Use avatar images optimized to an appropriate size.
|
|
409
420
|
|
|
410
|
-
4.
|
|
421
|
+
4. **Provide a fallback**: Prepare an appropriate fallback for missing or failed image loads.
|
|
411
422
|
|
|
412
423
|
```tsx
|
|
413
424
|
<Avatar src={user.avatar} alt={user.name} color="primary" variant="soft">
|
|
@@ -415,14 +426,14 @@ Avatar 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
415
426
|
</Avatar>
|
|
416
427
|
```
|
|
417
428
|
|
|
418
|
-
5.
|
|
429
|
+
5. **Meaningful usage**: It should be clear whom the avatar represents.
|
|
419
430
|
|
|
420
431
|
## Performance Considerations
|
|
421
432
|
|
|
422
|
-
1.
|
|
433
|
+
1. **Image optimization**: Optimize avatar images to a small size to improve loading speed.
|
|
423
434
|
|
|
424
|
-
2. **Lazy Loading**:
|
|
435
|
+
2. **Lazy Loading**: Consider lazy loading on pages with many avatars.
|
|
425
436
|
|
|
426
|
-
3.
|
|
437
|
+
3. **Caching**: Cache frequently used avatar images appropriately.
|
|
427
438
|
|
|
428
|
-
Avatar
|
|
439
|
+
Avatar is an important component for visually representing people in a user interface. By choosing the right size, color, and variant, you can provide a consistent and accessible user experience.
|
|
@@ -274,9 +274,7 @@ By default, Badge hides when `badgeContent` is `0`. Use the `showZero` prop to f
|
|
|
274
274
|
</div>
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
##
|
|
278
|
-
|
|
279
|
-
### Notification Bell
|
|
277
|
+
## Badge Notification Bell
|
|
280
278
|
|
|
281
279
|
```tsx
|
|
282
280
|
import { Badge, IconButton } from '@ceed/ads';
|
|
@@ -293,7 +291,7 @@ function NotificationBell({ unreadCount }) {
|
|
|
293
291
|
}
|
|
294
292
|
```
|
|
295
293
|
|
|
296
|
-
|
|
294
|
+
## Badge Online Status on Avatar
|
|
297
295
|
|
|
298
296
|
```tsx
|
|
299
297
|
import { Badge, Avatar } from '@ceed/ads';
|
|
@@ -311,7 +309,7 @@ function UserAvatar({ name, avatarUrl, isOnline }) {
|
|
|
311
309
|
}
|
|
312
310
|
```
|
|
313
311
|
|
|
314
|
-
|
|
312
|
+
## Badge New Feature Label
|
|
315
313
|
|
|
316
314
|
```tsx
|
|
317
315
|
import { Badge, Button } from '@ceed/ads';
|
|
@@ -339,6 +337,26 @@ function FeatureButton() {
|
|
|
339
337
|
|
|
340
338
|
- **Do not badge everything.** Only add badges to elements where the count or status information is genuinely useful. Overuse diminishes their attention-grabbing effect.
|
|
341
339
|
|
|
340
|
+
## Props and Customization
|
|
341
|
+
|
|
342
|
+
### Key Props
|
|
343
|
+
|
|
344
|
+
| Prop | Type | Default | Description |
|
|
345
|
+
| -------------- | ---------------------------------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------- |
|
|
346
|
+
| `badgeContent` | `ReactNode` | - | Content displayed inside the badge (number, text). Omit for dot badge |
|
|
347
|
+
| `children` | `ReactNode` | - | The element the badge is attached to |
|
|
348
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'danger'` | Badge color |
|
|
349
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Badge size |
|
|
350
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
351
|
+
| `max` | `number` | `99` | Maximum value before showing "N+" |
|
|
352
|
+
| `invisible` | `boolean` | `false` | Hides the badge |
|
|
353
|
+
| `showZero` | `boolean` | `false` | Shows badge when value is 0 |
|
|
354
|
+
| `anchorOrigin` | `{ vertical: 'top' \| 'bottom'; horizontal: 'left' \| 'right' }` | `{ vertical: 'top', horizontal: 'right' }` | Badge position |
|
|
355
|
+
| `badgeInset` | `string` | - | Custom inset for badge positioning |
|
|
356
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
357
|
+
|
|
358
|
+
> **Note**: Badge also accepts all Joy UI Badge props.
|
|
359
|
+
|
|
342
360
|
## Accessibility
|
|
343
361
|
|
|
344
362
|
- Badge automatically applies `aria-label` or equivalent attributes so screen readers can announce the badge content alongside the wrapped element.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Chip
|
|
5
|
+
The Chip component is a compact UI element used to represent inputs, attributes, and actions. It is commonly used for tags, filters, contacts, categories, and similar items. It can be used with text, icons, or avatars, and provides interactive behaviors such as clicking or deleting.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Chip {...args} />
|
|
@@ -39,11 +39,9 @@ function MyComponent() {
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Chip Basic Usage
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
기본적인 Chip 사용법입니다.
|
|
44
|
+
Basic Chip usage.
|
|
47
45
|
|
|
48
46
|
```tsx
|
|
49
47
|
<div style={{
|
|
@@ -57,9 +55,9 @@ function MyComponent() {
|
|
|
57
55
|
</div>
|
|
58
56
|
```
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
## Chip Colors
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
You can apply various colors.
|
|
63
61
|
|
|
64
62
|
```tsx
|
|
65
63
|
<div style={{
|
|
@@ -75,9 +73,9 @@ function MyComponent() {
|
|
|
75
73
|
</div>
|
|
76
74
|
```
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
## Chip Variants
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
Provides a variety of style variants.
|
|
81
79
|
|
|
82
80
|
```tsx
|
|
83
81
|
<div style={{
|
|
@@ -92,9 +90,9 @@ function MyComponent() {
|
|
|
92
90
|
</div>
|
|
93
91
|
```
|
|
94
92
|
|
|
95
|
-
|
|
93
|
+
## Chip Sizes
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
You can adjust the size.
|
|
98
96
|
|
|
99
97
|
```tsx
|
|
100
98
|
<div style={{
|
|
@@ -109,9 +107,9 @@ function MyComponent() {
|
|
|
109
107
|
</div>
|
|
110
108
|
```
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
## Chip with Icons
|
|
113
111
|
|
|
114
|
-
|
|
112
|
+
Can be used with icons.
|
|
115
113
|
|
|
116
114
|
```tsx
|
|
117
115
|
<div style={{
|
|
@@ -127,9 +125,9 @@ function MyComponent() {
|
|
|
127
125
|
</div>
|
|
128
126
|
```
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
## Chip with Avatar
|
|
131
129
|
|
|
132
|
-
|
|
130
|
+
Can be used with an avatar to represent a user.
|
|
133
131
|
|
|
134
132
|
```tsx
|
|
135
133
|
<div style={{
|
|
@@ -142,9 +140,9 @@ function MyComponent() {
|
|
|
142
140
|
</div>
|
|
143
141
|
```
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
## Deletable Chip
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
A Chip with delete functionality. Clicking it removes it from the list.
|
|
148
146
|
|
|
149
147
|
```tsx
|
|
150
148
|
<div style={{
|
|
@@ -158,9 +156,9 @@ function MyComponent() {
|
|
|
158
156
|
</div>
|
|
159
157
|
```
|
|
160
158
|
|
|
161
|
-
|
|
159
|
+
## Clickable Chip
|
|
162
160
|
|
|
163
|
-
|
|
161
|
+
A clickable Chip that can be used as a filter or tab.
|
|
164
162
|
|
|
165
163
|
```tsx
|
|
166
164
|
<div style={{
|
|
@@ -178,9 +176,9 @@ function MyComponent() {
|
|
|
178
176
|
</div>
|
|
179
177
|
```
|
|
180
178
|
|
|
181
|
-
|
|
179
|
+
## Chip Clickable Actions
|
|
182
180
|
|
|
183
|
-
|
|
181
|
+
Can trigger various actions when clicked.
|
|
184
182
|
|
|
185
183
|
```tsx
|
|
186
184
|
<div style={{
|
|
@@ -198,9 +196,9 @@ function MyComponent() {
|
|
|
198
196
|
</div>
|
|
199
197
|
```
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
## Chip States
|
|
202
200
|
|
|
203
|
-
|
|
201
|
+
Can represent various states.
|
|
204
202
|
|
|
205
203
|
```tsx
|
|
206
204
|
<div style={{
|
|
@@ -239,9 +237,7 @@ function MyComponent() {
|
|
|
239
237
|
</div>
|
|
240
238
|
```
|
|
241
239
|
|
|
242
|
-
##
|
|
243
|
-
|
|
244
|
-
### Tags
|
|
240
|
+
## Chip Tags
|
|
245
241
|
|
|
246
242
|
```tsx
|
|
247
243
|
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
|
@@ -251,7 +247,7 @@ function MyComponent() {
|
|
|
251
247
|
</div>
|
|
252
248
|
```
|
|
253
249
|
|
|
254
|
-
|
|
250
|
+
## Chip Status Indicators
|
|
255
251
|
|
|
256
252
|
```tsx
|
|
257
253
|
<Chip color="success" startDecorator={<CheckIcon />}>
|
|
@@ -262,7 +258,7 @@ function MyComponent() {
|
|
|
262
258
|
</Chip>
|
|
263
259
|
```
|
|
264
260
|
|
|
265
|
-
|
|
261
|
+
## Chip Filter Controls
|
|
266
262
|
|
|
267
263
|
```tsx
|
|
268
264
|
<Chip
|
|
@@ -274,7 +270,7 @@ function MyComponent() {
|
|
|
274
270
|
</Chip>
|
|
275
271
|
```
|
|
276
272
|
|
|
277
|
-
|
|
273
|
+
## Chip Contact Pills
|
|
278
274
|
|
|
279
275
|
```tsx
|
|
280
276
|
<Chip
|
|
@@ -286,16 +282,34 @@ function MyComponent() {
|
|
|
286
282
|
</Chip>
|
|
287
283
|
```
|
|
288
284
|
|
|
285
|
+
## Props and Customization
|
|
286
|
+
|
|
287
|
+
### Key Props
|
|
288
|
+
|
|
289
|
+
| Prop | Type | Default | Description |
|
|
290
|
+
| ---------------- | -------------------------------------------------------------- | ----------- | -------------------------------------- |
|
|
291
|
+
| `children` | `ReactNode` | - | Chip content (text, icons) |
|
|
292
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'soft'` | Visual style |
|
|
293
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Chip size |
|
|
294
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
295
|
+
| `disabled` | `boolean` | `false` | Disables the chip |
|
|
296
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click handler (makes chip interactive) |
|
|
297
|
+
| `startDecorator` | `ReactNode` | - | Content before the chip text |
|
|
298
|
+
| `endDecorator` | `ReactNode` | - | Content after the chip text |
|
|
299
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
300
|
+
|
|
301
|
+
> **Note**: Chip also accepts all Joy UI Chip props and Framer Motion props.
|
|
302
|
+
|
|
289
303
|
## Best Practices
|
|
290
304
|
|
|
291
|
-
1.
|
|
305
|
+
1. **Use appropriate sizes**: Choose sizes that fit the content. Keep text concise.
|
|
292
306
|
|
|
293
|
-
2.
|
|
307
|
+
2. **Be consistent**: Use the same variant and color within the same context.
|
|
294
308
|
|
|
295
|
-
3.
|
|
309
|
+
3. **Clear actions**: When using clickable or deletable behavior, provide clear feedback to the user.
|
|
296
310
|
|
|
297
|
-
4.
|
|
311
|
+
4. **Accessibility**: Support keyboard navigation and provide appropriate labels for screen readers.
|
|
298
312
|
|
|
299
|
-
5.
|
|
313
|
+
5. **Appropriate spacing**: Use proper spacing when listing multiple Chips to improve readability.
|
|
300
314
|
|
|
301
|
-
6.
|
|
315
|
+
6. **Semantic color usage**: Use colors with clear meaning, such as green for success and orange for warnings.
|