feat: add Checkbox and Radio field families

This commit is contained in:
maoyingjie
2026-10-22 09:15:27 +08:00
parent a4fb3c550a
commit bcadbeaf8c
75 changed files with 5293 additions and 22 deletions
@@ -0,0 +1,37 @@
<script setup lang="ts">
import {
CheckboxGroup,
CheckboxContent,
CheckboxControl,
CheckboxIndicator,
Checkbox,
Label,
Description,
} from "@heroui-vue/components";
const controlClassName = "bg-success-soft before:bg-success";
const indicatorClassName =
"**:data-[slot=checkbox-default-indicator--checkmark]:text-success-foreground";
const channels = [
{ label: "电子邮件", value: "email" },
{ label: "短信", value: "sms" },
{ label: "推送", value: "push" },
] as const;
</script>
<template>
<CheckboxGroup
class="gap-3 **:data-[slot=checkbox]:mt-0"
:default-value="['email']"
name="notification-channels"
>
<Label>通知渠道</Label>
<Description>选择我们通过何种方式向您发送账户更新。</Description>
<Checkbox v-for="{ label, value } in channels" :key="value" :value="value">
<CheckboxContent>
<CheckboxControl :class="controlClassName">
<CheckboxIndicator :class="indicatorClassName" />
</CheckboxControl>
{{ label }}
</CheckboxContent>
</Checkbox>
</CheckboxGroup>
</template>