feat: add Checkbox and Radio field families
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox name="basic-terms">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
接受条款与条件
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const isSelected = ref(true);
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-3">
|
||||
<Checkbox
|
||||
id="email-notifications"
|
||||
:is-selected="isSelected"
|
||||
@update:checked="isSelected = $event"
|
||||
>
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
邮件通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<p class="text-sm text-muted">
|
||||
状态:
|
||||
<span class="font-medium">{{ isSelected ? "已勾选" : "未勾选" }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconHeartFilled, IconPlus, IconMinus } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex gap-4">
|
||||
<Checkbox default-selected name="heart">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator v-slot="{ isSelected }">
|
||||
<IconHeartFilled v-if="isSelected" aria-hidden="true" />
|
||||
</CheckboxIndicator>
|
||||
</CheckboxControl>
|
||||
心形
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox default-selected name="plus">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator v-slot="{ isSelected }">
|
||||
<IconPlus v-if="isSelected" aria-hidden="true" />
|
||||
</CheckboxIndicator>
|
||||
</CheckboxControl>
|
||||
加号
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox is-indeterminate name="indeterminate">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator v-slot="{ isIndeterminate }">
|
||||
<IconMinus v-if="isIndeterminate" aria-hidden="true" />
|
||||
</CheckboxIndicator>
|
||||
</CheckboxControl>
|
||||
部分选中
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox id="custom">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl class="bg-success-soft before:bg-success">
|
||||
<CheckboxIndicator
|
||||
class="**:data-[slot=checkbox-default-indicator--checkmark]:text-success-foreground"
|
||||
/>
|
||||
</CheckboxControl>
|
||||
自定义样式复选框
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox default-selected id="default-notifications">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
启用邮件通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox is-disabled id="feature">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
高级功能
|
||||
</CheckboxContent>
|
||||
<Description>该功能即将推出</Description>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-3">
|
||||
<Checkbox id="label-marketing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Label for="label-marketing">给我发送营销邮件</Label>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,53 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Button,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const result = ref("");
|
||||
function submit(event: Event) {
|
||||
const data = new FormData(event.currentTarget as HTMLFormElement);
|
||||
result.value =
|
||||
"表单提交数据:\n" +
|
||||
Array.from(data)
|
||||
.map(([key, value]) => `${key}: ${value}`)
|
||||
.join("\n");
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<form class="flex flex-col gap-4" @submit.prevent="submit">
|
||||
<div class="flex flex-col gap-3">
|
||||
<Checkbox name="notifications" value="on">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
启用通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox default-selected name="newsletter" value="on">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
订阅新闻通讯
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox name="marketing" value="on">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
接收营销更新
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<Button class="mt-4" size="sm" type="submit" variant="primary">提交</Button>
|
||||
<pre v-if="result" role="status" class="whitespace-pre-wrap text-sm">{{
|
||||
result
|
||||
}}</pre>
|
||||
</form>
|
||||
</template>
|
||||
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-6">
|
||||
<div class="flex flex-col gap-3">
|
||||
<Label class="text-muted">圆角复选框</Label>
|
||||
<Checkbox
|
||||
class="[&_[data-slot='checkbox-default-indicator--checkmark']]:size-2"
|
||||
name="small-rounded"
|
||||
>
|
||||
<CheckboxContent>
|
||||
<CheckboxControl class="size-3 rounded-full before:rounded-full">
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
小尺寸
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div class="flex flex-col gap-3">
|
||||
<Checkbox name="default-rounded">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl class="size-4 rounded-full before:rounded-full">
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
默认尺寸
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div class="flex flex-col gap-3">
|
||||
<Checkbox name="large-rounded">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl class="size-5 rounded-full before:rounded-full">
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
大尺寸
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div class="flex flex-col gap-3">
|
||||
<Checkbox
|
||||
class="[&_[data-slot='checkbox-default-indicator--checkmark']]:size-4"
|
||||
name="xl-rounded"
|
||||
>
|
||||
<CheckboxContent>
|
||||
<CheckboxControl class="size-6 rounded-full before:rounded-full">
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
特大尺寸
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CheckboxGroup name="interests">
|
||||
<Label>选择你的兴趣</Label>
|
||||
<Description>可多选</Description>
|
||||
<Checkbox value="coding">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
编程
|
||||
</CheckboxContent>
|
||||
<Description>热爱构建软件</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="design">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
设计
|
||||
</CheckboxContent>
|
||||
<Description>喜欢打造精美界面</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="writing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
写作
|
||||
</CheckboxContent>
|
||||
<Description>热衷于内容创作</Description>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const selected = ref(["coding", "design"]);
|
||||
</script>
|
||||
<template>
|
||||
<CheckboxGroup
|
||||
class="min-w-[320px]"
|
||||
name="skills"
|
||||
:model-value="selected"
|
||||
@update:model-value="selected = $event"
|
||||
>
|
||||
<Label>你的技能</Label>
|
||||
<Checkbox value="coding">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
编程
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="design">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
设计
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="writing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
写作
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Label class="my-4 text-sm text-muted">
|
||||
已选:{{ selected.join(", ") || "无" }}
|
||||
</Label>
|
||||
</CheckboxGroup>
|
||||
</template>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CheckboxGroup is-disabled name="disabled-features">
|
||||
<Label>功能</Label>
|
||||
<Description>功能选择暂时不可用</Description>
|
||||
<Checkbox value="feature1">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
功能一
|
||||
</CheckboxContent>
|
||||
<Description>该功能即将推出</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="feature2">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
功能二
|
||||
</CheckboxContent>
|
||||
<Description>该功能即将推出</Description>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</template>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const selected = ref(["coding"]);
|
||||
const allOptions = ["coding", "design", "writing"];
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<Checkbox
|
||||
:is-indeterminate="
|
||||
selected.length > 0 && selected.length < allOptions.length
|
||||
"
|
||||
:checked="selected.length === allOptions.length"
|
||||
name="select-all"
|
||||
@update:checked="selected = $event ? [...allOptions] : []"
|
||||
>
|
||||
<CheckboxContent>
|
||||
<CheckboxControl><CheckboxIndicator /></CheckboxControl>
|
||||
全选
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<div class="ms-6 flex flex-col gap-2">
|
||||
<CheckboxGroup v-model="selected">
|
||||
<Checkbox value="coding">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
编程
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="design">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
设计
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="writing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
写作
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
Surface,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Surface class="w-full rounded-3xl p-6">
|
||||
<CheckboxGroup name="interests" variant="secondary">
|
||||
<Label>选择你的兴趣</Label>
|
||||
<Description>可多选</Description>
|
||||
<Checkbox value="coding">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
编程
|
||||
</CheckboxContent>
|
||||
<Description>热爱构建软件</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="design">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
设计
|
||||
</CheckboxContent>
|
||||
<Description>喜欢打造精美界面</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="writing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
写作
|
||||
</CheckboxContent>
|
||||
<Description>热衷于内容创作</Description>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</Surface>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CheckboxGroup name="interests" data-custom="foo">
|
||||
<Label>选择你的兴趣</Label>
|
||||
<Description>可多选</Description>
|
||||
<Checkbox value="coding">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
编程
|
||||
</CheckboxContent>
|
||||
<Description>热爱构建软件</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="design">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
设计
|
||||
</CheckboxContent>
|
||||
<Description>喜欢打造精美界面</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="writing">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
写作
|
||||
</CheckboxContent>
|
||||
<Description>热衷于内容创作</Description>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,53 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
FieldError,
|
||||
Button,
|
||||
Form,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const result = ref("");
|
||||
function submit(event: Event) {
|
||||
const data = new FormData(event.currentTarget as HTMLFormElement);
|
||||
result.value = "已选偏好:" + data.getAll("preferences").join(", ");
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Form class="flex flex-col gap-4 px-4" @submit.prevent="submit">
|
||||
<CheckboxGroup is-required name="preferences">
|
||||
<Label>偏好设置</Label>
|
||||
<Checkbox value="email">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
邮件通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="sms">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
短信通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<Checkbox value="push">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
推送通知
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
<FieldError>请至少选择一种通知方式。</FieldError>
|
||||
</CheckboxGroup>
|
||||
<Button type="submit">提交</Button>
|
||||
<p v-if="result" role="status" class="text-sm">{{ result }}</p>
|
||||
</Form>
|
||||
</template>
|
||||
@@ -0,0 +1,40 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxGroup,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconX } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<CheckboxGroup name="features">
|
||||
<Label>功能</Label>
|
||||
<Description>选择你需要的功能</Description>
|
||||
<Checkbox value="notifications">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator v-slot="{ isSelected }">
|
||||
<IconX v-if="isSelected" aria-hidden="true" />
|
||||
</CheckboxIndicator>
|
||||
</CheckboxControl>
|
||||
邮件通知
|
||||
</CheckboxContent>
|
||||
<Description>通过邮件接收更新</Description>
|
||||
</Checkbox>
|
||||
<Checkbox value="newsletter">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator v-slot="{ isSelected }">
|
||||
<IconX v-if="isSelected" aria-hidden="true" />
|
||||
</CheckboxIndicator>
|
||||
</CheckboxControl>
|
||||
邮件通讯
|
||||
</CheckboxContent>
|
||||
<Description>每周接收邮件简报</Description>
|
||||
</Checkbox>
|
||||
</CheckboxGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Checkbox,
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
const isIndeterminate = ref(true),
|
||||
isSelected = ref(false);
|
||||
function update(value: boolean) {
|
||||
isSelected.value = value;
|
||||
isIndeterminate.value = false;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox
|
||||
id="select-all"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
:checked="isSelected"
|
||||
@update:checked="update"
|
||||
>
|
||||
<CheckboxContent>
|
||||
<CheckboxControl><CheckboxIndicator /></CheckboxControl>
|
||||
全选
|
||||
</CheckboxContent>
|
||||
<Description>展示部分选中状态(短横线图标)</Description>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
FieldError,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox is-invalid is-required name="agreement">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
我同意条款
|
||||
</CheckboxContent>
|
||||
<FieldError>您必须接受条款才能继续</FieldError>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox data-custom="bar">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
接受条款与条件
|
||||
</CheckboxContent>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox id="render-props-terms" v-slot="{ isSelected }">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl><CheckboxIndicator /></CheckboxControl>
|
||||
{{ isSelected ? "已同意条款" : "接受条款" }}
|
||||
</CheckboxContent>
|
||||
<Description>
|
||||
{{ isSelected ? "感谢您的确认" : "请先阅读并接受条款" }}
|
||||
</Description>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm font-medium text-muted">主要变体</p>
|
||||
<Checkbox id="primary" name="primary" variant="primary">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
主要复选框
|
||||
</CheckboxContent>
|
||||
<Description>默认背景的标准样式</Description>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm font-medium text-muted">次要变体</p>
|
||||
<Checkbox id="secondary" name="secondary" variant="secondary">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
次要复选框
|
||||
</CheckboxContent>
|
||||
<Description>用于表面容器的低强调样式</Description>
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CheckboxContent,
|
||||
CheckboxControl,
|
||||
CheckboxIndicator,
|
||||
Checkbox,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Checkbox name="description-notifications">
|
||||
<CheckboxContent>
|
||||
<CheckboxControl>
|
||||
<CheckboxIndicator />
|
||||
</CheckboxControl>
|
||||
邮件通知
|
||||
</CheckboxContent>
|
||||
<Description>当有人在评论中提及您时收到通知</Description>
|
||||
</Checkbox>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<RadioGroup default-value="premium" name="plan">
|
||||
<Label>选择套餐</Label>
|
||||
<Description>选择最适合你的套餐</Description>
|
||||
<Radio value="basic">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
基础版
|
||||
</RadioContent>
|
||||
<Description>每月包含 100 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="premium">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
高级版
|
||||
</RadioContent>
|
||||
<Description>每月包含 200 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="business">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
商业版
|
||||
</RadioContent>
|
||||
<Description>无限消息</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const value = ref<string | undefined>("pro");
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<RadioGroup
|
||||
name="plan-controlled"
|
||||
:model-value="value"
|
||||
@update:model-value="value = $event"
|
||||
>
|
||||
<Label>订阅套餐</Label>
|
||||
<Radio value="starter">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
入门版
|
||||
</RadioContent>
|
||||
<Description>适合副项目和小型团队</Description>
|
||||
</Radio>
|
||||
<Radio value="pro">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
专业版
|
||||
</RadioContent>
|
||||
<Description>高级报表与分析</Description>
|
||||
</Radio>
|
||||
<Radio value="teams">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
团队版
|
||||
</RadioContent>
|
||||
<Description>最多可与 10 名队友共享访问权限</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
<p class="text-sm text-muted">
|
||||
已选套餐:
|
||||
<span class="font-medium">{{ value }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconCheck } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<RadioGroup default-value="premium" name="plan-custom-indicator">
|
||||
<Label>选择套餐</Label>
|
||||
<Description>选择最适合你的套餐</Description>
|
||||
<Radio value="basic">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator v-slot="{ isSelected }">
|
||||
<IconCheck
|
||||
v-if="isSelected"
|
||||
class="size-3 text-background"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</RadioIndicator>
|
||||
</RadioControl>
|
||||
基础版
|
||||
</RadioContent>
|
||||
<Description>每月包含 100 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="premium">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator v-slot="{ isSelected }">
|
||||
<IconCheck
|
||||
v-if="isSelected"
|
||||
class="size-3 text-background"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</RadioIndicator>
|
||||
</RadioControl>
|
||||
高级版
|
||||
</RadioContent>
|
||||
<Description>每月包含 200 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="business">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator v-slot="{ isSelected }">
|
||||
<IconCheck
|
||||
v-if="isSelected"
|
||||
class="size-3 text-background"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</RadioIndicator>
|
||||
</RadioControl>
|
||||
商业版
|
||||
</RadioContent>
|
||||
<Description>无限消息</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
const contentClassName =
|
||||
"group flex w-full items-start gap-3 rounded-xl border border-success/10 bg-success-soft/30 px-4 py-3 transition-colors data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-success/15 data-[hovered=true]:bg-success-soft-hover data-[selected=true]:border-success/30 data-[selected=true]:bg-success-soft data-[selected=true]:data-[hovered=true]:bg-success-soft-hover";
|
||||
const controlClassName =
|
||||
"mt-0.5 size-5 shrink-0 rounded-full border border-border bg-default shadow-none group-data-[pressed=true]:scale-95 group-data-[selected=true]:border-transparent group-data-[selected=true]:bg-success group-data-[selected=true]:group-data-[pressed=true]:bg-success-hover";
|
||||
const indicatorClassName =
|
||||
"before:rounded-full before:bg-default group-data-[selected=true]:before:scale-50 group-data-[selected=true]:before:bg-success-foreground group-data-[selected=true]:group-data-[pressed=true]:before:scale-[0.57]";
|
||||
const options = [
|
||||
{ description: "每月扣费 $12", label: "按月", value: "monthly" },
|
||||
{ description: "每年一次性扣费 $120", label: "按年", value: "yearly" },
|
||||
] as const;
|
||||
</script>
|
||||
<template>
|
||||
<RadioGroup
|
||||
class="w-full max-w-sm gap-3 **:data-[slot=radio]:mt-0"
|
||||
default-value="yearly"
|
||||
name="billing"
|
||||
variant="secondary"
|
||||
>
|
||||
<Label class="font-medium text-foreground">计费周期</Label>
|
||||
<Description>选择你的扣费频率。</Description>
|
||||
<Radio
|
||||
v-for="{ description, label, value } in options"
|
||||
:key="value"
|
||||
:value="value"
|
||||
>
|
||||
<RadioContent :class="contentClassName">
|
||||
<RadioControl :class="controlClassName">
|
||||
<RadioIndicator :class="indicatorClassName" />
|
||||
</RadioControl>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span
|
||||
class="font-medium text-foreground group-data-[selected=true]:text-success-soft-foreground"
|
||||
>
|
||||
{{ label }}
|
||||
</span>
|
||||
<Description
|
||||
class="group-data-[selected=true]:text-success-soft-foreground/80"
|
||||
>
|
||||
{{ description }}
|
||||
</Description>
|
||||
</div>
|
||||
</RadioContent>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,122 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconBrandMastercard,
|
||||
IconBrandVisa,
|
||||
IconBrandPaypal,
|
||||
} from "@tabler/icons-vue";
|
||||
const deliveryOptions = [
|
||||
{
|
||||
description: "4–10 个工作日",
|
||||
price: "$5.00",
|
||||
title: "标准",
|
||||
value: "standard",
|
||||
},
|
||||
{
|
||||
description: "2–5 个工作日",
|
||||
price: "$16.00",
|
||||
title: "快递",
|
||||
value: "express",
|
||||
},
|
||||
{
|
||||
description: "1 个工作日",
|
||||
price: "$25.00",
|
||||
title: "极速",
|
||||
value: "super-fast",
|
||||
},
|
||||
];
|
||||
const paymentOptions = [
|
||||
{
|
||||
description: "有效期至 2026/01",
|
||||
icon: IconBrandMastercard,
|
||||
title: "**** 8304",
|
||||
value: "mastercard",
|
||||
},
|
||||
{
|
||||
description: "有效期至 2026/01",
|
||||
icon: IconBrandVisa,
|
||||
title: "**** 0123",
|
||||
value: "visa",
|
||||
},
|
||||
{
|
||||
description: "使用 PayPal 支付",
|
||||
icon: IconBrandPaypal,
|
||||
title: "PayPal",
|
||||
value: "paypal",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="flex w-full flex-col items-center gap-10"
|
||||
style="
|
||||
--accent: #006fee;
|
||||
--accent-foreground: #fff;
|
||||
--accent-hover: #006fee;
|
||||
--border-width: 2px;
|
||||
--border-width-field: 2px;
|
||||
--focus: #006fee;
|
||||
"
|
||||
>
|
||||
<section class="flex w-full max-w-lg flex-col gap-4">
|
||||
<RadioGroup default-value="express" name="delivery" variant="secondary">
|
||||
<Label>配送方式</Label>
|
||||
<div class="grid gap-x-4 md:grid-cols-3">
|
||||
<Radio
|
||||
v-for="option in deliveryOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
<RadioContent
|
||||
class="group relative flex w-full flex-col gap-6 rounded-xl border border-transparent bg-surface px-5 py-4 transition-all data-[selected=true]:border-accent data-[selected=true]:bg-accent/10 data-[focus-visible=true]:border-accent data-[focus-visible=true]:bg-accent/10"
|
||||
>
|
||||
<RadioControl class="absolute end-4 top-3 size-5">
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span>{{ option.title }}</span>
|
||||
<Description>{{ option.description }}</Description>
|
||||
</div>
|
||||
<span class="text-sm font-semibold">{{ option.price }}</span>
|
||||
</RadioContent>
|
||||
</Radio>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</section>
|
||||
<section class="flex w-full max-w-lg flex-col gap-4">
|
||||
<RadioGroup default-value="visa" name="payment" variant="secondary">
|
||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||
<Label>支付方式</Label>
|
||||
</div>
|
||||
<div class="grid gap-x-4 md:grid-cols-2">
|
||||
<Radio
|
||||
v-for="option in paymentOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
<RadioContent
|
||||
class="group relative flex w-full flex-row items-start justify-start gap-4 rounded-xl border border-transparent bg-surface px-5 py-4 transition-all data-[selected=true]:border-accent data-[selected=true]:bg-accent/10"
|
||||
>
|
||||
<RadioControl class="absolute end-4 top-3 size-5">
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
<component :is="option.icon" class="size-6" aria-hidden="true" />
|
||||
<div class="flex flex-col gap-1">
|
||||
<span>{{ option.title }}</span>
|
||||
<Description>{{ option.description }}</Description>
|
||||
</div>
|
||||
</RadioContent>
|
||||
</Radio>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<RadioGroup is-disabled default-value="pro" name="plan-disabled">
|
||||
<Label>订阅套餐</Label>
|
||||
<Description>我们正在发布更新,暂时无法更改套餐。</Description>
|
||||
<Radio value="starter">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
入门版
|
||||
</RadioContent>
|
||||
<Description>适合副项目和小型团队</Description>
|
||||
</Radio>
|
||||
<Radio value="pro">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
专业版
|
||||
</RadioContent>
|
||||
<Description>高级报表与分析</Description>
|
||||
</Radio>
|
||||
<Radio value="teams">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
团队版
|
||||
</RadioContent>
|
||||
<Description>最多可与 10 名队友共享访问权限</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<Label id="plan-orientation-label">订阅套餐</Label>
|
||||
<RadioGroup
|
||||
default-value="pro"
|
||||
name="plan-orientation"
|
||||
aria-labelledby="plan-orientation-label"
|
||||
orientation="horizontal"
|
||||
>
|
||||
<Radio value="starter">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
入门版
|
||||
</RadioContent>
|
||||
<Description>适合副项目</Description>
|
||||
</Radio>
|
||||
<Radio value="pro">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
专业版
|
||||
</RadioContent>
|
||||
<Description>高级报表</Description>
|
||||
</Radio>
|
||||
<Radio value="teams">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
团队版
|
||||
</RadioContent>
|
||||
<Description>最多 10 名队友</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
Surface,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Surface class="w-full rounded-3xl p-6">
|
||||
<RadioGroup
|
||||
default-value="premium"
|
||||
name="plan-on-surface"
|
||||
variant="secondary"
|
||||
>
|
||||
<Label>选择套餐</Label>
|
||||
<Description>选择最适合你的套餐</Description>
|
||||
<Radio value="basic">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
基础版
|
||||
</RadioContent>
|
||||
<Description>每月包含 100 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="premium">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
高级版
|
||||
</RadioContent>
|
||||
<Description>每月包含 200 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="business">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
商业版
|
||||
</RadioContent>
|
||||
<Description>无限消息</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</Surface>
|
||||
</template>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<RadioGroup
|
||||
default-value="premium"
|
||||
name="plan-custom-render"
|
||||
data-custom="foo"
|
||||
>
|
||||
<Label>选择套餐</Label>
|
||||
<Description>选择最适合你的套餐</Description>
|
||||
<Radio value="basic">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
基础版
|
||||
</RadioContent>
|
||||
<Description>每月包含 100 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="premium">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
高级版
|
||||
</RadioContent>
|
||||
<Description>每月包含 200 条消息</Description>
|
||||
</Radio>
|
||||
<Radio value="business">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
商业版
|
||||
</RadioContent>
|
||||
<Description>无限消息</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const selection = ref<string | undefined>("pro");
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<RadioGroup
|
||||
default-value="pro"
|
||||
name="plan-uncontrolled"
|
||||
@update:model-value="selection = $event"
|
||||
>
|
||||
<Label>订阅套餐</Label>
|
||||
<Radio value="starter">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
入门版
|
||||
</RadioContent>
|
||||
<Description>适合副项目和小型团队</Description>
|
||||
</Radio>
|
||||
<Radio value="pro">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
专业版
|
||||
</RadioContent>
|
||||
<Description>高级报表与分析</Description>
|
||||
</Radio>
|
||||
<Radio value="teams">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
团队版
|
||||
</RadioContent>
|
||||
<Description>最多可与 10 名队友共享访问权限</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
<p class="text-sm text-muted">
|
||||
上次选择的套餐:
|
||||
<span class="font-medium">{{ selection }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Label,
|
||||
Description,
|
||||
FieldError,
|
||||
Button,
|
||||
Form,
|
||||
} from "@heroui-vue/components";
|
||||
import { ref } from "vue";
|
||||
const result = ref("");
|
||||
function submit(event: Event) {
|
||||
const data = new FormData(event.currentTarget as HTMLFormElement);
|
||||
result.value = "你选择的套餐是: " + data.get("plan-validation");
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Form class="flex flex-col gap-4" @submit.prevent="submit">
|
||||
<RadioGroup is-required name="plan-validation">
|
||||
<Label>订阅套餐</Label>
|
||||
<Radio value="starter">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
入门版
|
||||
</RadioContent>
|
||||
<Description>适合副项目和小型团队</Description>
|
||||
</Radio>
|
||||
<Radio value="pro">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
专业版
|
||||
</RadioContent>
|
||||
<Description>高级报表与分析</Description>
|
||||
</Radio>
|
||||
<Radio value="teams">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
团队版
|
||||
</RadioContent>
|
||||
<Description>最多可与 10 名队友共享访问权限</Description>
|
||||
</Radio>
|
||||
<FieldError>请先选择订阅套餐再继续。</FieldError>
|
||||
</RadioGroup>
|
||||
<Button class="mt-2 w-fit" type="submit">Submit</Button>
|
||||
<p v-if="result" role="status" class="text-sm">{{ result }}</p>
|
||||
</Form>
|
||||
</template>
|
||||
@@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
RadioGroup,
|
||||
RadioContent,
|
||||
RadioControl,
|
||||
RadioIndicator,
|
||||
Radio,
|
||||
Description,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-8">
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm font-medium text-muted">主要变体</p>
|
||||
<RadioGroup default-value="option1" name="primary-plan" variant="primary">
|
||||
<Radio value="option1">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
选项 1
|
||||
</RadioContent>
|
||||
<Description>默认背景的标准样式</Description>
|
||||
</Radio>
|
||||
<Radio value="option2">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
选项 2
|
||||
</RadioContent>
|
||||
<Description>另一种主要样式选项</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm font-medium text-muted">次要变体</p>
|
||||
<RadioGroup
|
||||
default-value="option1"
|
||||
name="secondary-plan"
|
||||
variant="secondary"
|
||||
>
|
||||
<Radio value="option1">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
选项 1
|
||||
</RadioContent>
|
||||
<Description>用于表面上的低强调变体</Description>
|
||||
</Radio>
|
||||
<Radio value="option2">
|
||||
<RadioContent>
|
||||
<RadioControl>
|
||||
<RadioIndicator />
|
||||
</RadioControl>
|
||||
选项 2
|
||||
</RadioContent>
|
||||
<Description>另一种次要样式选项</Description>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user