@ceed/ads 1.29.1 → 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/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +10 -0
- 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 +87 -5
- package/dist/components/inputs/DateRangePicker.md +91 -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/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +173 -6
- package/dist/index.js +173 -6
- package/framer/index.js +1 -1
- 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).
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Input from '../Input';
|
|
3
|
+
export interface DatePickerPreset {
|
|
4
|
+
/** 프리셋 버튼에 표시할 라벨 */
|
|
5
|
+
label: string;
|
|
6
|
+
/** 컴포넌트의 format에 맞는 날짜 문자열 (예: "2026/04/03") */
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
3
9
|
interface BaseDatePickerProps {
|
|
4
10
|
/**
|
|
5
11
|
* props.format 의 형식을 따라야 한다.
|
|
@@ -39,6 +45,10 @@ interface BaseDatePickerProps {
|
|
|
39
45
|
* @returns If `true` the date will be disabled
|
|
40
46
|
*/
|
|
41
47
|
shouldDisableDate?: (date: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 달력 옆에 표시할 프리셋 목록. 각 항목의 value는 format prop의 형식을 따라야 한다.
|
|
50
|
+
*/
|
|
51
|
+
presets?: DatePickerPreset[];
|
|
42
52
|
}
|
|
43
53
|
export type DatePickerProps = BaseDatePickerProps & Omit<React.ComponentProps<typeof Input>, 'onChange' | 'value' | 'defaultValue'>;
|
|
44
54
|
declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Input from '../Input';
|
|
3
|
+
export interface DateRangePickerPreset {
|
|
4
|
+
/** 프리셋 버튼에 표시할 라벨 */
|
|
5
|
+
label: string;
|
|
6
|
+
/** 컴포넌트의 format에 맞는 날짜 범위 문자열 (예: "2026/03/31 - 2026/04/03") */
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
3
9
|
interface BaseDateRangePickerProps {
|
|
4
10
|
/**
|
|
5
11
|
* props.format 의 형식을 따라야 한다.
|
|
@@ -32,6 +38,10 @@ interface BaseDateRangePickerProps {
|
|
|
32
38
|
displayFormat?: string;
|
|
33
39
|
inputReadOnly?: boolean;
|
|
34
40
|
hideClearButton?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 달력 옆에 표시할 프리셋 목록. 각 항목의 value는 format prop의 형식을 따라야 한다.
|
|
43
|
+
*/
|
|
44
|
+
presets?: DateRangePickerPreset[];
|
|
35
45
|
}
|
|
36
46
|
export type DateRangePickerProps = BaseDateRangePickerProps & Omit<React.ComponentProps<typeof Input>, 'onChange' | 'value' | 'defaultValue'>;
|
|
37
47
|
declare const DateRangePicker: React.ForwardRefExoticComponent<Omit<DateRangePickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -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.
|