Cài đặt
Chạy trong app, sau shadcn-vue init và theme Beehexa (Nút › Code):
npx shadcn-vue@latest add https://beehexa.design/r/button.json
npx shadcn-vue@latest add https://beehexa.design/r/action-bar.json
Cách dùng
<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: 'Đơn hàng sang ERP' },
{ id: 'stock', name: 'Tồn kho từ kho' },
{ id: 'customers', name: 'Khách hàng sang CRM' },
]
const selected = ref<string[]>(['orders', 'stock'])
const status = computed(() => `${selected.value.length} kết nối đã chọn`)
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-100)">
<ActionBar
:open="selected.length > 0"
:status="status"
label="Thao tác cho các kết nối đã chọn"
clear-label="Bỏ chọn"
@clear="selected = []"
>
<Button variant="outline" size="sm"><Pause />Tạm dừng</Button>
<Button variant="outline" size="sm"><Download />Xuất</Button>
<Button variant="ghost-destructive" size="sm"><Trash2 />Xóa</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 | Giá trị | Ghi chú |
|---|---|---|
open |
boolean | True khi có ít nhất một hàng được chọn |
status |
chuỗi | Số lượng, như “3 kết nối đã chọn” |
label |
chuỗi | Tên vùng, như “Thao tác cho các hàng đã chọn” |
clearLabel |
chuỗi, mặc định Clear selection |
Tên nút đóng |
@clear |
sự kiện | Nút đóng và Esc; hãy bỏ chọn |
Dựng từ
Component của Beehexa, không có bản tương ứng trong shadcn-vue. Các thao tác bên trong là Button cỡ nhỏ.