Components
Radio Group
RadioGroup, dressed in the paper-and-ink system: a column of full-circle seals that fill flat with primary ink when chosen, the dot punched through as paper. The parts — Root, Label, Item, ItemText, ItemControl, Indicator, ItemHiddenInput.
#Basic usage
Ground
<script setup lang="ts">
import { RadioGroup } from "@bysages/vue";
const papers = [
{ value: "xuan", label: "Xuan paper" },
{ value: "silk", label: "Silk" },
{ value: "bamboo", label: "Bamboo slips" },
];
</script>
<template>
<RadioGroup.Root default-value="xuan">
<RadioGroup.Label>Ground</RadioGroup.Label>
<RadioGroup.Item v-for="p in papers" :key="p.value" :value="p.value">
<RadioGroup.ItemControl />
<RadioGroup.ItemText>{{ p.label }}</RadioGroup.ItemText>
<RadioGroup.ItemHiddenInput />
</RadioGroup.Item>
</RadioGroup.Root>
</template>
#Props
#Indicator
A styled part — no props of its own; it takes the anatomy's shared styling.
#ItemContext
A styled part — no props of its own; it takes the anatomy's shared styling.
#ItemControl
A styled part — no props of its own; it takes the anatomy's shared styling.
#ItemHiddenInput
A styled part — no props of its own; it takes the anatomy's shared styling.
#ItemText
A styled part — no props of its own; it takes the anatomy's shared styling.
#Item
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | undefined | — | |
invalid | boolean | undefined | — | |
value | string | — |
#Label
A styled part — no props of its own; it takes the anatomy's shared styling.
#Root
| Prop | Type | Default | Description |
|---|---|---|---|
size | String as PropType<"sm" | "md" | "lg"> | "md" | One rung for the dial; the chosen dot rides it. |
defaultValue | string | null | The initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group. | |
disabled | boolean | If true, the radio group will be disabled | |
form | string | The associate form of the underlying input. | |
id | string | The unique identifier of the machine. | |
ids | Partial<{ root: string; label: string; indicator: string; item(value: string): string; itemLabel(value: string): string; itemControl(value: string): string; itemHiddenInput(value: string): string; }> | The ids of the elements in the radio. Useful for composition. | |
invalid | boolean | Whether the radio group is invalid | |
modelValue | string | null | The v-model value of the radio group | |
name | string | The name of the input fields in the radio (Useful for form submission). | |
orientation | 'horizontal' | 'vertical' | Orientation of the radio group | |
readOnly | boolean | Whether the checkbox is read-only | |
required | boolean | Whether the radio group is required |