feat: add Checkbox and Radio field families
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user