On this page

Action bar

Install, props and the parts Action bar is built from.

Install

Run these in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/button.json
npx shadcn-vue@latest add https://beehexa.design/r/action-bar.json

Use

<script setup lang="ts">
import { Download, Pause, Trash2 } from '@lucide/vue'
import { computed, ref } from 'vue'
import { ActionBar } from '@/components/ui/action-bar'
import { Button } from '@/components/ui/button'

const rows = [
  { id: 'orders', name: 'Orders to ERP' },
  { id: 'stock', name: 'Stock from warehouse' },
  { id: 'customers', name: 'Customers to CRM' },
]
const selected = ref<string[]>(['orders', 'stock'])
const status = computed(() => `${selected.value.length} ${selected.value.length === 1 ? 'connection' : 'connections'} selected`)
</script>

<template>
  <div class="flex w-full max-w-120 flex-col gap-(--bh-space-100)">
    <ActionBar
      :open="selected.length > 0"
      :status="status"
      label="Actions for selected connections"
      clear-label="Clear selection"
      @clear="selected = []"
    >
      <Button variant="outline" size="sm"><Pause />Pause</Button>
      <Button variant="outline" size="sm"><Download />Export</Button>
      <Button variant="ghost-destructive" size="sm"><Trash2 />Delete</Button>
    </ActionBar>
    <ul class="m-0 list-none p-0">
      <li v-for="row in rows" :key="row.id" class="border-b-(length:--bh-border-width-default) border-(--bh-color-border) py-(--bh-space-100)">
        <label class="flex cursor-pointer items-center gap-(--bh-space-100)">
          <input v-model="selected" type="checkbox" :value="row.id" class="size-(--bh-size-icon-default) accent-(--bh-color-background-primary)">
          {{ row.name }}
        </label>
      </li>
    </ul>
  </div>
</template>

Props

Prop Values Notes
open boolean True while at least one row is selected
status string The count, such as “3 connections selected”
label string Region name, such as “Actions for selected rows”
clearLabel string, default Clear selection Name of the close button
@clear event Close button and Esc; clear the selection

Built on

A Beehexa component with no shadcn-vue counterpart. The actions inside are small Buttons.