feat: add Checkbox and Radio field families
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconMail, IconMessage, IconBell } from "@tabler/icons-vue";
|
||||
const addOns = [
|
||||
{
|
||||
description: "通过邮件接收更新",
|
||||
icon: IconMail,
|
||||
title: "邮件通知",
|
||||
value: "email",
|
||||
},
|
||||
{
|
||||
description: "即时短信通知",
|
||||
icon: IconMessage,
|
||||
title: "短信提醒",
|
||||
value: "sms",
|
||||
},
|
||||
{
|
||||
description: "浏览器与移动端推送提醒",
|
||||
icon: IconBell,
|
||||
title: "推送通知",
|
||||
value: "push",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex w-full flex-col items-center gap-10 px-4 py-8">
|
||||
<section class="flex w-full min-w-[320px] max-sm:min-w-0 flex-col gap-4">
|
||||
<CheckboxGroup name="notification-preferences">
|
||||
<Label>通知偏好</Label>
|
||||
<Description>选择接收更新的方式</Description>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Checkbox
|
||||
v-for="addon in addOns"
|
||||
:key="addon.value"
|
||||
:value="addon.value"
|
||||
variant="secondary"
|
||||
>
|
||||
<CheckboxContent
|
||||
class="group relative flex w-full flex-row items-start justify-start gap-4 rounded-3xl bg-surface px-5 py-4 transition-all data-[selected=true]:bg-accent/10"
|
||||
>
|
||||
<CheckboxControl
|
||||
class="absolute end-4 top-3 size-5 rounded-full before:rounded-full"
|
||||
>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
<component
|
||||
:is="addon.icon"
|
||||
class="size-5 text-accent-soft-foreground"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span>{{ addon.title }}</span>
|
||||
<Description>{{ addon.description }}</Description>
|
||||
</div>
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
</CheckboxGroup>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user