Trên trang này

Bubble

Cài đặt, prop và các phần tạo nên Bubble.

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/bubble.json

Cách dùng

<script setup lang="ts">
import { Bubble, BubbleContent, BubbleReactions } from '@/components/ui/bubble'
</script>

<template>
  <Bubble variant="secondary">
    <BubbleContent>Cả 240 sản phẩm đã lên cửa hàng online.</BubbleContent>
    <BubbleReactions>
      <span aria-hidden="true">🎉 2</span><span class="sr-only">2 lượt ăn mừng</span>
    </BubbleReactions>
  </Bubble>
</template>

Prop

Phần Prop Giá trị Ghi chú
Bubble variant default, secondary, muted, tinted, outline, ghost, destructive Xem Cách dùng › Các biến thể
Bubble align start (mặc định), end Trong Message, align của message đã đặt vị trí cho nó
BubbleContent as, as-child tên phần tử, boolean as="button" hoặc link với as-child cho bubble bấm được
BubbleReactions side bottom (mặc định), top Mép mà nó treo lên
BubbleReactions align end (mặc định), start Bên mà nó nằm
BubbleGroup as, as-child tên phần tử, boolean Các bubble gửi liền nhau

bubbleVariants và bubbleReactionsVariants được export để dựng phần riêng.

Dựng từ

Các phần tử thường qua Primitive của reka-ui, theo API Bubble của shadcn-vue. Beehexa thêm style. Biến thể tinted giữ tên nhưng dùng color.background.brand.subtle với viền brand: Beehexa không pha màu từ màu khác, nên khi hover viền đậm lên thành color.border.brand thay vì đổi nền.