You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -57,21 +57,14 @@ import {Breadcrumbs, Item, Link} from 'react-aria-components';
57
57
58
58
```css
59
59
.react-aria-Breadcrumbs {
60
-
& ol {
61
-
display: flex;
62
-
align-items: center;
63
-
list-style: none;
64
-
margin: 0;
65
-
padding: 0;
66
-
font-size: 18px;
67
-
}
68
-
69
-
.react-aria-Heading {
70
-
margin: 0;
71
-
font-size: 1em;
72
-
}
73
-
74
-
.react-aria-Item:not(:last-child)::after {
60
+
display: flex;
61
+
align-items: center;
62
+
list-style: none;
63
+
margin: 0;
64
+
padding: 0;
65
+
font-size: 18px;
66
+
67
+
.react-aria-Breadcrumb:not(:last-child)::after {
75
68
content: '›';
76
69
content: '›' / '';
77
70
alt: '';
@@ -135,25 +128,23 @@ Breadcrumbs provide a list of links to parent pages of the current page in hiera
135
128
`Breadcrumbs` helps implement these in an accessible way.
136
129
137
130
***Flexible** – Support for navigation links, JavaScript handled links, or custom element types (e.g. router links).
138
-
***Accessible** – Implemented as a navigation landmark with an ordered list of links. Optional support for using breadcrumbs as a heading is available as well.
131
+
***Accessible** – Implemented as an ordered list of links. The last link is automatically marked as the current page using `aria-current`.
139
132
***Styleable** – Hover, press, and keyboard focus states are provided for easy styling. These states only apply when interacting with an appropriate input device, unlike CSS pseudo classes.
140
133
141
134
## Anatomy
142
135
143
136
<Anatomy />
144
137
145
-
Breadcrumbs consist of a navigation landmark element and a list of links, typically with a visual separator
138
+
Breadcrumbs consist of a list of links, typically with a visual separator
146
139
icon between each item. The last link represents the current page in the hierarchy, with the previous links representing the
147
140
parent pages of the current page. Each of these parent links can be clicked, tapped, or
148
-
triggered via the <Keyboard>Enter</Keyboard> key to navigate to that page. Optionally, breadcrumbs can be used
149
-
in place of a page title, in which case the last breadcrumb acts as a heading.
141
+
triggered via the <Keyboard>Enter</Keyboard> key to navigate to that page.
The last breadcrumb may be used as a heading for the page by placing a `<Heading>` element within the `<Item>` instead of a `<Link>`. By default, this is an `h3` element, but this can be changed with the `level` prop on the `Heading`.
@@ -272,32 +249,58 @@ import ChevronIcon from '@spectrum-icons/workflow/ChevronDoubleRight';
272
249
273
250
</details>
274
251
252
+
## Landmarks
253
+
254
+
When breadcrumbs are used as a main navigation element for a page, they can be placed in a [navigation landmark](https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/navigation.html). Landmarks help assistive technology users quickly find major sections of a page. Place breadcrumbs inside a `<nav>` element with an `aria-label` to create a navigation landmark.
It is best to keep the number of landmarks on a page to a minimum, so only place breadcrumbs in a navigation landmark when it represents the primary or secondary navigation for the page. For example, breadcrumbs within table rows or popovers most likely should not be landmarks.
267
+
275
268
## Disabled
276
269
277
270
Breadcrumbs can be disabled using the `isDisabled` prop. This indicates that navigation is not currently available. When a breadcrumb is disabled, `onPress` will not be triggered, navigation will not occur, and links will be marked as `aria-disabled` for assistive technologies.
React Aria components can be styled in many ways, including using CSS classes, inline styles, utility classes (e.g. Tailwind), CSS-in-JS (e.g. Styled Components), etc. By default, all components include a builtin `className` attribute which can be targeted using CSS selectors. These follow the `react-aria-ComponentName` naming convention.
@@ -334,19 +337,11 @@ The states, selectors, and render props for all components used in `Breadcrumbs`
334
337
335
338
### Breadcrumbs
336
339
337
-
`Breadcrumbs` can be targed with the `.react-aria-Breadcrumbs` CSS selector, or by overriding with a custom `className`. It is rendered as a `<nav>` element, and contains an `<ol>` element representing the list of items. This additional element can be targed with the `ol` selector.
338
-
339
-
```css render=false
340
-
.react-aria-Breadcrumbs {
341
-
& ol {
342
-
/* ... */
343
-
}
344
-
}
345
-
```
340
+
`Breadcrumbs` can be targed with the `.react-aria-Breadcrumbs` CSS selector, or by overriding with a custom `className`. It is rendered as an `<ol>` element representing the list of items.
346
341
347
-
### Item
342
+
### Breadcrumb
348
343
349
-
An `Item` can be targeted with the `.react-aria-Item` CSS selector, or by overriding with a custom `className`. It is rendered as an `<li>` element, and should contain a `<Link>` or `<Heading>`. It may also include another element such as a [separator icon](#separator-icons).
344
+
A `Breadcrumb` can be targeted with the `.react-aria-Breadcrumb` CSS selector, or by overriding with a custom `className`. It is rendered as an `<li>` element, and should contain a `<Link>`. It may also include another element such as a [separator icon](#separator-icons).
350
345
351
346
### Link
352
347
@@ -410,7 +405,7 @@ Now when you place `Breadcrumbs` inside a `Router`, it automatically has access
@@ -424,33 +419,34 @@ Now when you place `Breadcrumbs` inside a `Router`, it automatically has access
424
419
425
420
Breadcrumbs passes props to its child components, such as the links, via their associated contexts. These contexts are exported so you can also consume them in your own custom components. This enables you to reuse existing components from your app or component library together with React Aria Components.
This example consumes from `HeadingContext` in an existing styled heading component to make it compatible with React Aria Components. The <TypeLinklinks={docs.links}type={docs.exports.useContextProps} /> hook merges the local props and ref with the ones provided via context by Breadcrumbs.
424
+
This example consumes from `LinkContext` in an existing styled link component to make it compatible with React Aria Components. The <TypeLinklinks={docs.links}type={docs.exports.useContextProps} /> hook merges the local props and ref with the ones provided via context by Breadcrumbs. [useLink](useLink.html) returns DOM props to spread onto the link element.
0 commit comments