Actions
Layout
Toolbar
A strip of related controls with arrow-key focus and an overflow menu for what doesn’t fit. Use it to group the actions for one view or one editor.
Install
import { Toolbar } from 'vael-ui'Playground
horizontal
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { Toolbar, Button } from 'vael-ui'
</script>
<template>
<Toolbar>
<Button variant="ghost" size="sm">Bold</Button>
<Button variant="ghost" size="sm">Italic</Button>
<Button variant="ghost" size="sm" data-toolbar-overflow>Cut</Button>
<Button variant="ghost" size="sm" data-toolbar-overflow>Copy</Button>
<Button variant="ghost" size="sm" data-toolbar-overflow>Paste</Button>
</Toolbar>
</template>Motion New
Toolbar: its appearance, and how the hover highlight moves.
<Toolbar
:motion="{ initial: { item: { opacity: 0, y: 4 } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | rootitemindicator | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
move | (parts, context) => animation | Moves its sliding indicator. A spring retimes it, and a move hook animates it with your own library, starting from context.from. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
Follows the Toolbar pattern from the WAI-ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| Tab | Moves focus to the item focused last, then out of the toolbar. |
| ArrowRightArrowLeft | Moves to the next or previous item in a horizontal toolbar, wrapping at the ends. |
| ArrowDownArrowUp | Moves to the next or previous item in a vertical toolbar, wrapping at the ends. |
| HomeEnd | Moves to the first or last item. |
- Renders
role="toolbar", witharia-orientation="vertical"when vertical. Passaria-labelto name it. - Items use a roving
tabindex, so the toolbar is one Tab stop. Disabled items are skipped. Text fields, selects and editable areas inside keep their own arrow keys, Home and End, as does a child that callspreventDefault. - Items that overflow are hidden and listed in a Menu behind a button named by
overflowLabel(a translated “More” by default). Toggles witharia-pressedshow there as checkbox rows. - Right to left, ArrowLeft and ArrowRight swap.