Files
heroui-vue/apps/docs/demos/checkbox-group-custom-styles.vue
T
2026-10-22 09:15:27 +08:00

38 lines
1.1 KiB
Vue

<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>