Button group VButtonGroup groups related actions and shares layout and appearance settings across VButton and VIconButton.
Usage <script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<VButtonGroup variant="outline" tone="neutral" label="Text alignment">
<VButton>Left</VButton>
<VButton>Centre</VButton>
<VButton>Right</VButton>
</VButtonGroup>
</template> Examples Variants and tones The group’s variant overrides each button’s variant. Its tone applies only to buttons without their own tone.
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
const variants = ['solid', 'soft', 'outline', 'ghost'] as const
const tones = ['accent', 'neutral', 'danger'] as const
</script>
<template>
<div v-for="tone in tones" :key="tone" class="row">
<VButtonGroup
v-for="variant in variants"
:key="variant"
:variant="variant"
:tone="tone"
:label="`${variant} ${tone}`"
>
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-4);
}
</style> Individual tones Set a button’s tone to override the group’s tone, for example to mark a destructive action.
Rename Duplicate Delete
Rename Duplicate Delete
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup variant="outline" tone="neutral" label="Row actions, outline">
<VButton>Rename</VButton>
<VButton>Duplicate</VButton>
<VButton tone="danger">Delete</VButton>
</VButtonGroup>
<VButtonGroup variant="soft" tone="neutral" label="Row actions, tonal">
<VButton>Rename</VButton>
<VButton>Duplicate</VButton>
<VButton tone="danger">Delete</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
}
</style> Orientation orientation="vertical" stacks the buttons in a column.
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<VButtonGroup variant="outline" tone="neutral" label="Range, as a row">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup orientation="vertical" variant="outline" tone="neutral" label="Range, as a column">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</template> Detached detached separates the buttons while preserving the group’s appearance settings.
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup variant="outline" tone="neutral" label="Joined">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup detached variant="outline" tone="neutral" label="Detached">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
}
</style> Dividers Joined buttons have no inner dividers by default. bordered adds them. Has no effect with detached.
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup variant="outline" tone="neutral" label="Without lines">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup bordered variant="outline" tone="neutral" label="Bordered">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
}
</style> Elevated elevated adds one shadow to a joined group, or a shadow to each button when detached.
Day Week Month
Day Week Month
Day Week Month
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup variant="ghost" tone="neutral" label="Flat">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup elevated variant="ghost" tone="neutral" label="Raised">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup elevated detached variant="ghost" tone="neutral" label="Raised, detached">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-4);
}
</style> Sizes size sets the size of every button, overriding individual sizes.
Day Week Month
Day Week Month
Day Week Month
Day Week Month
Day Week Month
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const
</script>
<template>
<div class="column">
<VButtonGroup
v-for="size in sizes"
:key="size"
:size="size"
variant="outline"
tone="neutral"
:label="`Range, ${size}`"
>
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
}
</style> Full width fullWidth fills the parent’s width. Horizontal groups give each button equal width.
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup variant="outline" tone="neutral" label="As wide as its labels">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
<VButtonGroup full-width variant="outline" tone="neutral" label="Filling the column">
<VButton>Day</VButton>
<VButton>Week</VButton>
<VButton>Month</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
inline-size: 320px;
}
</style> With icons Use iconStart and iconEnd on buttons, or VIconButton with a required label.
<script setup lang="ts">
import { VButton, VButtonGroup, VIconButton } from 'vectis-ui'
import {
arrow_downward as arrowDownward,
arrow_upward as arrowUpward,
description,
image,
swap_vert as swapVert,
table_chart as tableChart,
} from 'vectis-ui/icons'
</script>
<template>
<VButtonGroup variant="outline" tone="neutral" label="View">
<VButton :icon-start="description">List</VButton>
<VButton :icon-start="tableChart">Table</VButton>
<VButton :icon-start="image">Gallery</VButton>
</VButtonGroup>
<VButtonGroup role="toolbar" variant="outline" tone="neutral" label="Sort">
<VIconButton :icon="arrowUpward" label="Ascending" />
<VIconButton :icon="swapVert" label="Unsorted" />
<VIconButton :icon="arrowDownward" label="Descending" />
</VButtonGroup>
</template> Links Set href on a button to render a link. Disabled or loading links cannot navigate.
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<VButtonGroup variant="outline" tone="neutral" label="Sections of this page">
<VButton href="#usage">Usage</VButton>
<VButton href="#examples">Examples</VButton>
<VButton href="#api">API</VButton>
<VButton href="#usage" disabled>Changelog</VButton>
</VButtonGroup>
</template> States disabled disables every button. Set loading on individual buttons.
Rename Duplicate Delete
Rename Duplicate Loading… Deleting
<script setup lang="ts">
import { VButton, VButtonGroup } from 'vectis-ui'
</script>
<template>
<div class="column">
<VButtonGroup disabled variant="outline" tone="neutral" label="Row switched off">
<VButton>Rename</VButton>
<VButton>Duplicate</VButton>
<VButton>Delete</VButton>
</VButtonGroup>
<VButtonGroup variant="outline" tone="neutral" label="One segment at a time">
<VButton>Rename</VButton>
<VButton disabled>Duplicate</VButton>
<VButton loading>Deleting</VButton>
</VButtonGroup>
</div>
</template>
<style scoped>
.column {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--vectis-space-3);
}
</style> API Props Slots