Split button
VSplitButton joins a main action to a menu of related ones. The main action is a VButton; the button beside it opens a VMenu.
Usage
Last action: Nothing yet
Examples
Variants and tones
variant, tone, size and elevated take the values of VButton and apply to both halves. A line always separates them.
Sizes
The menu button stays square at every size.
Loading and disabled
loading puts the spinner in the main action and disables the menu button too, since an action is already under way. disabled turns off both halves.
Link and icons
href turns the main action into a link. iconStart and iconEnd belong to the main action, and menuIcon replaces the chevron. menuLabel replaces the name screen readers hear for the menu button, "More options" by default.
Full width and menu placement
The menu is anchored to the whole control and lines up with its end by default. With fullWidth, the main action takes the room and the menu button stays square; matchTrigger keeps the menu at least as wide as the control.
Router
VSplitButton renders a real <a> when href is set. With Nuxt or Vue Router, render it inside the router link in custom mode and pass on href and navigate. A click with a modifier key still opens a new tab. Only the main button navigates.
<RouterLink v-slot="{ href, navigate }" to="/settings" custom>
<VSplitButton :href="href" label="Settings" menu-label="More settings" @click="navigate">
<VMenuItem label="Reset" />
</VSplitButton>
</RouterLink>API
Props
| Prop | Type | Default |
|---|---|---|
label | string | none |
| Text of the main action. | ||
variant | ButtonVariant'solid' | 'outline' | 'ghost' | 'soft' | 'solid' |
| Visual weight of both halves. | ||
tone | ButtonTone'accent' | 'neutral' | 'danger' | 'accent' |
| Colour of both halves. | ||
size | ButtonSize'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| Height of both halves, from the shared control scale. | ||
elevated | boolean | false |
| Raises the control with a shadow. | ||
fullWidth | boolean | false |
| Fills the parent. The main action takes the room; the menu button stays square. | ||
href | string | none |
| Turns the main action into a link, inert while disabled or loading. | ||
type | ButtonHTMLAttributes['type'] | 'button' |
| Native type of the main button. | ||
disabled | boolean | false |
| Disables both halves. | ||
loading | boolean | false |
| Shows a spinner in the main action and disables the menu button. | ||
iconStart | IconSource | none |
| Icon before the label of the main action. | ||
iconEnd | IconSource | none |
| Icon after the label of the main action. | ||
iconFilled | boolean | false |
| Renders the icons of the main action filled. | ||
menuLabel | string | none |
| Accessible name of the menu button. "More options" by default. | ||
menuIcon | IconSource | expand_more |
| Icon of the menu button. | ||
placement | MenuPlacement'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'bottom-end' |
| Menu position relative to the whole control; adjusts when space is short. | ||
menuSize | MenuSize'sm' | 'md' | 'lg' | 'sm' |
| Row height of the menu. | ||
menuWidth | number | string | none |
| Menu width. Numbers use pixels; strings use CSS lengths or keywords. | ||
matchTrigger | boolean | false |
| Keeps the menu at least as wide as the whole control. | ||
v-model:open | boolean | false |
| Open state of the menu. | ||
Events
| Event | Type |
|---|---|
click | [event: MouseEvent] |
| The main action was activated. | |
Slots
| Slot | Type |
|---|---|
default | {} |
VMenuItem, VMenuGroup and VMenuSeparator children. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender