Calm motion: animations on this site only fade, with no movement
Bulk action bar
A bar of actions for the selected rows
Comes up when a person selects rows in a list or a table, with the count and the actions for all of them, for example Archive or Delete. Use it with the selection of a data table or a list of checkboxes.
Basic
vue
<template>
<div style="max-width: 480px">
<BlessStack :gap="2">
<BlessCheckbox
v-for="e in episodes"
:key="e.id"
:model-value="picked.includes(e.id)"
@update:model-value="toggle(e.id, !!$event)"
>
{{ e.title }}
</BlessCheckbox>
</BlessStack>
<div style="height: 72px" />
<BlessBulkActionBar :count="picked.length" @clear="picked = []">
<BlessButton size="sm" variant="ghost" @click="picked = []">Archive</BlessButton>
<BlessButton size="sm" variant="ghost" @click="remove">Delete</BlessButton>
</BlessBulkActionBar>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { BlessBulkActionBar, BlessButton, BlessCheckbox, BlessStack } from "blessing-ui";
const episodes = ref(
[
"Ep. 36 · Microphones",
"Ep. 37 · Guests",
"Ep. 38 · Editing",
"Ep. 39 · Sponsors",
"Ep. 40 · Live show",
].map((title, i) => ({ id: i, title })),
);
const picked = ref<number[]>([]);
const toggle = (id: number, on: boolean) =>
(picked.value = on ? [...picked.value, id] : picked.value.filter((x) => x !== id));
function remove() {
episodes.value = episodes.value.filter((e) => !picked.value.includes(e.id));
picked.value = [];
}
</script>countis how many rows are selected. If it is more than 0, the bar comes up. At 0, the bar goes away.- Put the action buttons in the default slot. They show light text on the dark bar. The × button emits
clear, and your app clears the selection. - The bar sticks to the bottom of the box that scrolls, so it stays in view over a long list.
fixedputs it on the bottom of the window. - The bar is a toolbar: it has one Tab stop, and the arrow keys move between the buttons. A new count is spoken, for example "3 selected".
- The bar slides up into view. With reduced motion, it shows at once.
- Change the words with
labelsor a label pack:label(the name of the toolbar),selected(a function of the count), andclear.
Usage
ts
import { BlessBulkActionBar } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
count* | number | — | how many rows are selected; the bar shows when it is more than 0 |
fixed | boolean | — | on the bottom of the window, not the bottom of its box |
labels | Partial<{ label: string; selected: (n: number) => string; clear: string; }> | — |
Events
| Name | Payload | Description |
|---|---|---|
clear | [] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |