Cài đặt
Chạy lệnh này trong app, sau shadcn-vue init và theme Beehexa (Button › Code):
npx shadcn-vue@latest add https://beehexa.design/r/item.json
Lệnh này cài cả Separator, mà ItemSeparator dùng.
Cách dùng
<script setup lang="ts">
import { ShoppingCart } from '@lucide/vue'
import { Button } from '@/components/ui/button'
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from '@/components/ui/item'
</script>
<template>
<Item variant="outline">
<ItemMedia variant="icon"><ShoppingCart aria-hidden="true" /></ItemMedia>
<ItemContent>
<ItemTitle>Cửa hàng online</ItemTitle>
<ItemDescription>Đơn hàng và khách hàng, mỗi 15 phút</ItemDescription>
</ItemContent>
<ItemActions>
<Button variant="outline" size="sm">Cài đặt</Button>
</ItemActions>
</Item>
</template>
Prop
| Phần | Prop | Giá trị | Ghi chú |
|---|---|---|---|
Item |
variant |
default, outline, muted |
|
Item |
size |
default, sm, xs |
|
Item |
as, as-child |
phần tử hoặc boolean | Mặc định div. as-child với thẻ <a> biến mục thành link |
ItemMedia |
variant |
default, icon, image |
image lấy bậc cỡ của mục |
itemVariants và itemMediaVariants trả về class cho phần tử khác.
Dựng từ
Các phần tử thường và một Primitive của reka-ui, với API Item của shadcn-vue. Beehexa thêm style; mục là link thì hover như dòng bảng và có vòng focus như Button.