@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
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
The Breadcrumbs component displays a navigation trail that helps users understand their current location within a
|
|
5
|
+
The Breadcrumbs component displays a navigation trail that helps users understand their current location within a hierarchical structure and navigate back to previous levels. Each level in the path is represented as a clickable link except for the current page, which is displayed as plain text.
|
|
6
|
+
|
|
7
|
+
Breadcrumbs are essential for sites with deep navigation hierarchies -- they provide context at a glance, reduce the number of steps needed to return to higher-level pages, and improve overall wayfinding within an application.
|
|
6
8
|
|
|
7
9
|
```tsx
|
|
8
10
|
<Breadcrumbs
|
|
@@ -56,18 +58,18 @@ function MyComponent() {
|
|
|
56
58
|
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
57
59
|
{ label: 'Products', type: 'link', linkHref: '/products' },
|
|
58
60
|
{ label: 'Electronics', type: 'link', linkHref: '/products/electronics' },
|
|
59
|
-
{ label: 'Laptops', type: 'text' },
|
|
61
|
+
{ label: 'Laptops', type: 'text' },
|
|
60
62
|
];
|
|
61
63
|
|
|
62
64
|
return <Breadcrumbs crumbs={crumbs} />;
|
|
63
65
|
}
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
##
|
|
68
|
+
## Features
|
|
67
69
|
|
|
68
70
|
### Basic Breadcrumbs
|
|
69
71
|
|
|
70
|
-
A simple breadcrumb
|
|
72
|
+
A simple breadcrumb trail with a few levels of hierarchy. The last item uses `type: 'text'` to indicate the current page.
|
|
71
73
|
|
|
72
74
|
```tsx
|
|
73
75
|
<Breadcrumbs
|
|
@@ -89,7 +91,7 @@ A simple breadcrumb navigation with three levels.
|
|
|
89
91
|
|
|
90
92
|
### Sizes
|
|
91
93
|
|
|
92
|
-
Breadcrumbs
|
|
94
|
+
Breadcrumbs are available in three sizes -- `sm`, `md`, and `lg` -- allowing you to match the surrounding layout density.
|
|
93
95
|
|
|
94
96
|
```tsx
|
|
95
97
|
<div>
|
|
@@ -99,9 +101,9 @@ Breadcrumbs support different sizes.
|
|
|
99
101
|
</div>
|
|
100
102
|
```
|
|
101
103
|
|
|
102
|
-
###
|
|
104
|
+
### Custom Separator
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
The separator character between items can be customized via the `separator` prop. Common choices include `/`, `>`, and `-`.
|
|
105
107
|
|
|
106
108
|
```tsx
|
|
107
109
|
<div style={{
|
|
@@ -150,45 +152,7 @@ Customize the separator between breadcrumb items.
|
|
|
150
152
|
|
|
151
153
|
### Collapsed Breadcrumbs
|
|
152
154
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
<Breadcrumbs
|
|
157
|
-
crumbs={[{
|
|
158
|
-
label: 'Home',
|
|
159
|
-
type: 'link',
|
|
160
|
-
linkHref: '/'
|
|
161
|
-
}, {
|
|
162
|
-
label: 'Catalog',
|
|
163
|
-
type: 'link',
|
|
164
|
-
linkHref: '/'
|
|
165
|
-
}, {
|
|
166
|
-
label: 'Category',
|
|
167
|
-
type: 'link',
|
|
168
|
-
linkHref: '/'
|
|
169
|
-
}, {
|
|
170
|
-
label: 'Subcategory',
|
|
171
|
-
type: 'link',
|
|
172
|
-
linkHref: '/'
|
|
173
|
-
}, {
|
|
174
|
-
label: 'Product',
|
|
175
|
-
type: 'link',
|
|
176
|
-
linkHref: '/'
|
|
177
|
-
}, {
|
|
178
|
-
label: 'Product Detail',
|
|
179
|
-
type: 'link',
|
|
180
|
-
linkHref: '/'
|
|
181
|
-
}, {
|
|
182
|
-
label: 'Owner',
|
|
183
|
-
type: 'text'
|
|
184
|
-
}]}
|
|
185
|
-
collapsed
|
|
186
|
-
/>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Collapsed Variants
|
|
190
|
-
|
|
191
|
-
Configure how many items show at the start and end when collapsed.
|
|
155
|
+
When paths are deep, the component automatically collapses middle items behind an ellipsis. You can control how many items appear at the start and end using `startCrumbCount` and `endCrumbCount`.
|
|
192
156
|
|
|
193
157
|
```tsx
|
|
194
158
|
<div style={{
|
|
@@ -251,23 +215,9 @@ Configure how many items show at the start and end when collapsed.
|
|
|
251
215
|
</div>
|
|
252
216
|
```
|
|
253
217
|
|
|
254
|
-
### Single Crumb
|
|
255
|
-
|
|
256
|
-
When there's only one item in the path.
|
|
257
|
-
|
|
258
|
-
```tsx
|
|
259
|
-
<Breadcrumbs
|
|
260
|
-
crumbs={[{
|
|
261
|
-
label: 'Home',
|
|
262
|
-
type: 'text'
|
|
263
|
-
}]}
|
|
264
|
-
collapsed
|
|
265
|
-
/>
|
|
266
|
-
```
|
|
267
|
-
|
|
268
218
|
### Expanded View
|
|
269
219
|
|
|
270
|
-
|
|
220
|
+
Setting `collapsed={false}` renders every item in the path without collapsing.
|
|
271
221
|
|
|
272
222
|
```tsx
|
|
273
223
|
<Breadcrumbs
|
|
@@ -303,105 +253,80 @@ Show all breadcrumb items without collapsing.
|
|
|
303
253
|
/>
|
|
304
254
|
```
|
|
305
255
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
### ✅ Good Use Cases
|
|
309
|
-
|
|
310
|
-
- **Deep hierarchies**: Sites with 3+ levels of navigation depth
|
|
311
|
-
- **E-commerce sites**: Product category → subcategory → product navigation
|
|
312
|
-
- **Documentation sites**: Section → topic → article navigation
|
|
313
|
-
- **File management**: Folder → subfolder → file navigation
|
|
314
|
-
- **Admin dashboards**: Module → submodule → detail view
|
|
315
|
-
- **Content management**: Categories and nested content structures
|
|
316
|
-
|
|
317
|
-
### ❌ When Not to Use
|
|
318
|
-
|
|
319
|
-
- **Flat sites**: Single-level navigation doesn't need breadcrumbs
|
|
320
|
-
- **Linear flows**: For sequential processes, use Stepper instead
|
|
321
|
-
- **Primary navigation**: Breadcrumbs supplement, not replace, main navigation
|
|
322
|
-
- **Mobile-first**: Consider if space allows; may need alternative patterns
|
|
323
|
-
- **Dynamic content**: When paths frequently change or are user-specific
|
|
256
|
+
### Single Crumb
|
|
324
257
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
### E-commerce Product Page
|
|
258
|
+
The component handles the edge case of a single breadcrumb item gracefully.
|
|
328
259
|
|
|
329
260
|
```tsx
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
];
|
|
338
|
-
|
|
339
|
-
return (
|
|
340
|
-
<Box>
|
|
341
|
-
<Breadcrumbs crumbs={crumbs} />
|
|
342
|
-
<ProductDetails product={product} />
|
|
343
|
-
</Box>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
261
|
+
<Breadcrumbs
|
|
262
|
+
crumbs={[{
|
|
263
|
+
label: 'Home',
|
|
264
|
+
type: 'text'
|
|
265
|
+
}]}
|
|
266
|
+
collapsed
|
|
267
|
+
/>
|
|
346
268
|
```
|
|
347
269
|
|
|
348
|
-
###
|
|
270
|
+
### With Icons
|
|
349
271
|
|
|
350
|
-
|
|
351
|
-
function DocPage({ section, topic, article }) {
|
|
352
|
-
const crumbs = [
|
|
353
|
-
{ label: 'Docs', type: 'link', linkHref: '/docs' },
|
|
354
|
-
{ label: section.title, type: 'link', linkHref: `/docs/${section.slug}` },
|
|
355
|
-
{ label: topic.title, type: 'link', linkHref: `/docs/${section.slug}/${topic.slug}` },
|
|
356
|
-
{ label: article.title, type: 'text' },
|
|
357
|
-
];
|
|
272
|
+
Breadcrumb items can include icons alongside their labels.
|
|
358
273
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
274
|
+
```tsx
|
|
275
|
+
<Breadcrumbs {...args} crumbs={[{
|
|
276
|
+
label: 'Home',
|
|
277
|
+
type: 'link',
|
|
278
|
+
linkHref: '/'
|
|
279
|
+
}, {
|
|
280
|
+
label: 'Settings',
|
|
281
|
+
type: 'link',
|
|
282
|
+
linkHref: '/settings'
|
|
283
|
+
}, {
|
|
284
|
+
label: 'Profile',
|
|
285
|
+
type: 'text'
|
|
286
|
+
}]} collapsed={false} />
|
|
367
287
|
```
|
|
368
288
|
|
|
369
|
-
|
|
289
|
+
## Common Use Cases
|
|
290
|
+
|
|
291
|
+
### Admin Dashboard Navigation
|
|
370
292
|
|
|
371
293
|
```tsx
|
|
372
|
-
function
|
|
294
|
+
function UserDetailPage({ user }) {
|
|
373
295
|
const crumbs = [
|
|
374
|
-
{ label: '
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
type: index === path.length - 1 ? 'text' : 'link',
|
|
378
|
-
linkHref: `/files/${path.slice(0, index + 1).map(f => f.id).join('/')}`,
|
|
379
|
-
})),
|
|
296
|
+
{ label: 'Dashboard', type: 'link', linkHref: '/admin' },
|
|
297
|
+
{ label: 'Users', type: 'link', linkHref: '/admin/users' },
|
|
298
|
+
{ label: user.name, type: 'text' },
|
|
380
299
|
];
|
|
381
300
|
|
|
382
301
|
return (
|
|
383
302
|
<Box>
|
|
384
|
-
<Breadcrumbs crumbs={crumbs}
|
|
385
|
-
<
|
|
303
|
+
<Breadcrumbs crumbs={crumbs} />
|
|
304
|
+
<UserProfile user={user} />
|
|
386
305
|
</Box>
|
|
387
306
|
);
|
|
388
307
|
}
|
|
389
308
|
```
|
|
390
309
|
|
|
391
|
-
###
|
|
310
|
+
### E-commerce Product Page
|
|
392
311
|
|
|
393
312
|
```tsx
|
|
394
|
-
function
|
|
313
|
+
function ProductPage({ product, category, subcategory }) {
|
|
395
314
|
const crumbs = [
|
|
396
|
-
{ label: '
|
|
397
|
-
{ label: '
|
|
398
|
-
{ label:
|
|
315
|
+
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
316
|
+
{ label: 'Shop', type: 'link', linkHref: '/shop' },
|
|
317
|
+
{ label: category.name, type: 'link', linkHref: `/shop/${category.slug}` },
|
|
318
|
+
{
|
|
319
|
+
label: subcategory.name,
|
|
320
|
+
type: 'link',
|
|
321
|
+
linkHref: `/shop/${category.slug}/${subcategory.slug}`,
|
|
322
|
+
},
|
|
323
|
+
{ label: product.name, type: 'text' },
|
|
399
324
|
];
|
|
400
325
|
|
|
401
326
|
return (
|
|
402
327
|
<Box>
|
|
403
|
-
<Breadcrumbs crumbs={crumbs} />
|
|
404
|
-
<
|
|
328
|
+
<Breadcrumbs crumbs={crumbs} collapsed={true} startCrumbCount={1} endCrumbCount={2} />
|
|
329
|
+
<ProductDetails product={product} />
|
|
405
330
|
</Box>
|
|
406
331
|
);
|
|
407
332
|
}
|
|
@@ -412,222 +337,55 @@ function UserDetailPage({ user }) {
|
|
|
412
337
|
```tsx
|
|
413
338
|
function DynamicBreadcrumbs() {
|
|
414
339
|
const location = useLocation();
|
|
415
|
-
const pathnames = location.pathname.split('/').filter(
|
|
340
|
+
const pathnames = location.pathname.split('/').filter(Boolean);
|
|
416
341
|
|
|
417
342
|
const crumbs = [
|
|
418
343
|
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
419
|
-
...pathnames.map((value, index) => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
label: formatLabel(value),
|
|
425
|
-
type: isLast ? 'text' : 'link',
|
|
426
|
-
linkHref: href,
|
|
427
|
-
};
|
|
428
|
-
}),
|
|
344
|
+
...pathnames.map((value, index) => ({
|
|
345
|
+
label: formatLabel(value),
|
|
346
|
+
type: index === pathnames.length - 1 ? 'text' : 'link',
|
|
347
|
+
linkHref: `/${pathnames.slice(0, index + 1).join('/')}`,
|
|
348
|
+
})),
|
|
429
349
|
];
|
|
430
350
|
|
|
431
351
|
return <Breadcrumbs crumbs={crumbs} />;
|
|
432
352
|
}
|
|
433
353
|
```
|
|
434
354
|
|
|
435
|
-
## Props and Customization
|
|
436
|
-
|
|
437
|
-
### Key Props
|
|
438
|
-
|
|
439
|
-
| Prop | Type | Default | Description |
|
|
440
|
-
| ----------------- | ---------------------- | ------- | ----------------------------------------------- |
|
|
441
|
-
| `crumbs` | `Crumb[]` | `[]` | Array of breadcrumb items |
|
|
442
|
-
| `collapsed` | `boolean` | `true` | Collapse middle items with ellipsis |
|
|
443
|
-
| `startCrumbCount` | `number` | `1` | Number of items to show at start when collapsed |
|
|
444
|
-
| `endCrumbCount` | `number` | `3` | Number of items to show at end when collapsed |
|
|
445
|
-
| `separator` | `string` | `'/'` | Separator between items |
|
|
446
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the breadcrumbs |
|
|
447
|
-
|
|
448
|
-
### Crumb Type
|
|
449
|
-
|
|
450
|
-
```tsx
|
|
451
|
-
interface Crumb {
|
|
452
|
-
label: string; // Display text
|
|
453
|
-
type: 'link' | 'text'; // Link or static text
|
|
454
|
-
linkHref?: string; // URL for link type
|
|
455
|
-
}
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
### Collapsed Behavior
|
|
459
|
-
|
|
460
|
-
When `collapsed` is true and there are more items than `startCrumbCount + endCrumbCount`, middle items are replaced with an ellipsis:
|
|
461
|
-
|
|
462
|
-
```tsx
|
|
463
|
-
// With startCrumbCount=1, endCrumbCount=2, and 6 crumbs:
|
|
464
|
-
// Home / ... / Category / Product
|
|
465
|
-
|
|
466
|
-
<Breadcrumbs
|
|
467
|
-
crumbs={crumbs}
|
|
468
|
-
collapsed={true}
|
|
469
|
-
startCrumbCount={1}
|
|
470
|
-
endCrumbCount={2}
|
|
471
|
-
/>
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Custom Styling
|
|
475
|
-
|
|
476
|
-
```tsx
|
|
477
|
-
<Breadcrumbs
|
|
478
|
-
crumbs={crumbs}
|
|
479
|
-
sx={{
|
|
480
|
-
'& .MuiBreadcrumbs-separator': {
|
|
481
|
-
mx: 1,
|
|
482
|
-
color: 'neutral.400',
|
|
483
|
-
},
|
|
484
|
-
'& a': {
|
|
485
|
-
color: 'primary.500',
|
|
486
|
-
textDecoration: 'none',
|
|
487
|
-
'&:hover': {
|
|
488
|
-
textDecoration: 'underline',
|
|
489
|
-
},
|
|
490
|
-
},
|
|
491
|
-
}}
|
|
492
|
-
/>
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
## Accessibility
|
|
496
|
-
|
|
497
|
-
Breadcrumbs include important accessibility features:
|
|
498
|
-
|
|
499
|
-
### Semantic HTML
|
|
500
|
-
|
|
501
|
-
- Uses `<nav>` element with `aria-label="breadcrumb"`
|
|
502
|
-
- Structured as an ordered list (`<ol>`) to indicate sequence
|
|
503
|
-
- Current page marked with `aria-current="page"`
|
|
504
|
-
|
|
505
|
-
### ARIA Attributes
|
|
506
|
-
|
|
507
|
-
```tsx
|
|
508
|
-
// Generated HTML structure
|
|
509
|
-
<nav aria-label="breadcrumb">
|
|
510
|
-
<ol>
|
|
511
|
-
<li><a href="/">Home</a></li>
|
|
512
|
-
<li><a href="/products">Products</a></li>
|
|
513
|
-
<li aria-current="page">Current Page</li>
|
|
514
|
-
</ol>
|
|
515
|
-
</nav>
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
### Keyboard Navigation
|
|
519
|
-
|
|
520
|
-
- **Tab**: Navigate through breadcrumb links
|
|
521
|
-
- **Enter**: Activate the focused link
|
|
522
|
-
|
|
523
|
-
### Screen Reader Support
|
|
524
|
-
|
|
525
|
-
- Screen readers announce "breadcrumb navigation"
|
|
526
|
-
- Each link is announced with its position in the sequence
|
|
527
|
-
- Current page is identified as the current location
|
|
528
|
-
|
|
529
|
-
### SEO Benefits
|
|
530
|
-
|
|
531
|
-
Breadcrumbs provide:
|
|
532
|
-
|
|
533
|
-
- Clear site structure for search engines
|
|
534
|
-
- Enhanced search result display (rich snippets)
|
|
535
|
-
- Improved internal linking
|
|
536
|
-
|
|
537
355
|
## Best Practices
|
|
538
356
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
1. **Start with Home**: Always begin with a link to the homepage
|
|
357
|
+
- **Always start with a root item.** Begin the trail with "Home" or an equivalent top-level link so users can always navigate back to the starting point.
|
|
542
358
|
|
|
543
359
|
```tsx
|
|
544
|
-
//
|
|
360
|
+
// Good
|
|
545
361
|
const crumbs = [
|
|
546
362
|
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
547
|
-
{ label: '
|
|
548
|
-
{ label: 'Laptops', type: 'text' },
|
|
363
|
+
{ label: 'Settings', type: 'text' },
|
|
549
364
|
];
|
|
365
|
+
|
|
366
|
+
// Bad -- missing root item
|
|
367
|
+
const crumbs = [{ label: 'Settings', type: 'text' }];
|
|
550
368
|
```
|
|
551
369
|
|
|
552
|
-
|
|
370
|
+
- **Make the current page non-clickable.** The last item in the trail should use `type: 'text'` since clicking the current page serves no purpose.
|
|
553
371
|
|
|
554
372
|
```tsx
|
|
555
|
-
//
|
|
373
|
+
// Good
|
|
556
374
|
{ label: 'Current Page', type: 'text' }
|
|
557
375
|
|
|
558
|
-
//
|
|
376
|
+
// Bad
|
|
559
377
|
{ label: 'Current Page', type: 'link', linkHref: '/current' }
|
|
560
378
|
```
|
|
561
379
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
4. **Maintain consistency**: Use the same labels as page titles or navigation
|
|
565
|
-
|
|
566
|
-
5. **Position at top**: Place breadcrumbs near the top of the page, below the header
|
|
567
|
-
|
|
568
|
-
### ❌ Don't
|
|
569
|
-
|
|
570
|
-
1. **Don't use as primary navigation**: Breadcrumbs supplement main navigation
|
|
571
|
-
|
|
572
|
-
2. **Don't duplicate with page title**: If the current page title is visible, breadcrumbs can end with the parent
|
|
573
|
-
|
|
574
|
-
```tsx
|
|
575
|
-
// Consider ending at parent if title is displayed
|
|
576
|
-
const crumbs = [
|
|
577
|
-
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
578
|
-
{ label: 'Products', type: 'link', linkHref: '/products' },
|
|
579
|
-
// Omit if "Laptops" is shown as page title
|
|
580
|
-
];
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
3. **Don't use for flat navigation**: Sites with only one or two levels don't need breadcrumbs
|
|
584
|
-
|
|
585
|
-
4. **Don't hide on mobile carelessly**: Either show a simplified version or omit entirely
|
|
380
|
+
- **Use collapsing for deep hierarchies.** When paths exceed four or five levels, enable `collapsed` to keep the UI clean and avoid horizontal overflow.
|
|
586
381
|
|
|
587
|
-
|
|
382
|
+
- **Keep labels concise.** Breadcrumb labels should be short but descriptive. Match them to the corresponding page titles for consistency.
|
|
588
383
|
|
|
589
|
-
|
|
384
|
+
- **Do not use breadcrumbs as primary navigation.** They are a supplementary wayfinding aid, not a replacement for the main navigation menu.
|
|
590
385
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
```tsx
|
|
594
|
-
const crumbs = useMemo(() => [
|
|
595
|
-
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
596
|
-
{ label: category.name, type: 'link', linkHref: `/category/${category.id}` },
|
|
597
|
-
{ label: product.name, type: 'text' },
|
|
598
|
-
], [category, product]);
|
|
599
|
-
|
|
600
|
-
<Breadcrumbs crumbs={crumbs} />
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
### Use Collapsed for Deep Hierarchies
|
|
604
|
-
|
|
605
|
-
For paths with many levels, use collapsing to reduce DOM elements:
|
|
606
|
-
|
|
607
|
-
```tsx
|
|
608
|
-
<Breadcrumbs
|
|
609
|
-
crumbs={deepHierarchy}
|
|
610
|
-
collapsed={true}
|
|
611
|
-
startCrumbCount={1}
|
|
612
|
-
endCrumbCount={2}
|
|
613
|
-
/>
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
### Lazy Load for Dynamic Breadcrumbs
|
|
617
|
-
|
|
618
|
-
If breadcrumb data requires fetching, ensure it doesn't block page render:
|
|
619
|
-
|
|
620
|
-
```tsx
|
|
621
|
-
function Page() {
|
|
622
|
-
const { data: breadcrumbData, isLoading } = useBreadcrumbPath();
|
|
623
|
-
|
|
624
|
-
return (
|
|
625
|
-
<Box>
|
|
626
|
-
{!isLoading && <Breadcrumbs crumbs={breadcrumbData} />}
|
|
627
|
-
<PageContent />
|
|
628
|
-
</Box>
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
```
|
|
386
|
+
## Accessibility
|
|
632
387
|
|
|
633
|
-
|
|
388
|
+
- **Semantic HTML**: The component renders a `<nav>` element with `aria-label="breadcrumb"` and an ordered list (`<ol>`) to convey the sequential nature of the trail.
|
|
389
|
+
- **Current page indicator**: The last item is automatically marked with `aria-current="page"` so screen readers announce the user's current location.
|
|
390
|
+
- **Keyboard navigation**: All link items are focusable with `Tab` and activated with `Enter`, following standard keyboard interaction patterns.
|
|
391
|
+
- **Screen readers**: The navigation landmark is announced as "breadcrumb navigation" and each link communicates its position within the path hierarchy.
|