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
Toolbar provides keyboard navigation and announcements for groups of interactive elements.
119
-
`Toolbar` helps implement these in an accessible way.
111
+
There is no built-in HTML toolbar element. `Toolbar` helps achieve accessible toolbars with arrow key navigation that can be styled as needed.
120
112
121
-
***Flexible** – Support for various RAC or Aria Hooks implemented components.
122
-
***Accessible** – Follows the [ARIA toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/) with support for keyboard arrow key navigation and is a single tab stop.
123
-
***Styleable** – Can be styled in any custom way, including extra DOM structure between the Toolbar and the interactive children.
113
+
***Flexible** – Support for interactive children such as buttons, checkboxes, dropdown menus, etc. in a horizontal or vertical orientation.
114
+
***Accessible** – Follows the [ARIA toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/) with support for arrow key navigation as a single tab stop.
124
115
125
116
## Anatomy
126
117
127
118
<Anatomy />
128
119
129
-
Toolbar consists of a wrapping element which controls arrow key navigation depending on the orientation and children.
120
+
A toolbar consists of a container element for a set of interactive controls. It provides arrow key navigation between its children, in either horizontal or vertical orientation.
121
+
122
+
```tsx
123
+
import {Toolbar} from'react-aria-components';
124
+
125
+
<Toolbar>
126
+
{/* ... */}
127
+
</Toolbar>
128
+
```
129
+
130
+
## Orientation
131
+
132
+
By default, toolbars are horizontally oriented. The `orientation` prop can be set to `"vertical"` to change the arrow key navigation behavior.
<summarystyle={{fontWeight: 'bold'}}><ChevronRightsize="S" /> Show CSS</summary>
157
+
158
+
```css
159
+
.react-aria-Toolbar {
160
+
width: fit-content;
161
+
162
+
&[data-orientation=vertical] {
163
+
flex-direction: column;
164
+
align-items: start;
165
+
}
166
+
}
167
+
168
+
.react-aria-Separator {
169
+
&:not([aria-orientation=vertical]) {
170
+
border: none;
171
+
height: 1px;
172
+
width: 100%;
173
+
margin: 10px0;
174
+
}
175
+
}
176
+
```
177
+
178
+
</details>
130
179
131
180
## Props
132
181
@@ -163,6 +212,22 @@ A custom `className` can also be specified on any component. This overrides the
163
212
</Toolbar>
164
213
```
165
214
215
+
The `className` and `style` props also accept functions which receive states for styling. This lets you dynamically determine the classes or styles to apply, which is useful when using utility CSS libraries like [Tailwind](https://tailwindcss.com/).
The selectors and render props for each component used in a `Toolbar` are documented below.
224
+
225
+
### Toolbar
226
+
227
+
A `Toolbar` can be targeted with the `.react-aria-Toolbar` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
0 commit comments