diff --git a/docs/content/3.components/radio-group.md b/docs/content/3.components/radio-group.md index 9a2e1f7626..0a1a7dfa2b 100644 --- a/docs/content/3.components/radio-group.md +++ b/docs/content/3.components/radio-group.md @@ -99,6 +99,34 @@ props: --- :: +### Variant + +Use the `variant` prop to change the variant of the RadioGroup. + +::component-code +--- +prettier: true +ignore: + - defaultValue + - items +external: + - items +props: + variant: 'table' + defaultValue: 'pro' + items: + - label: 'Pro' + value: 'pro' + description: 'Tailored for indie hackers, freelancers and solo founders.' + - label: 'Startup' + value: 'startup' + description: 'Best suited for small teams, startups and agencies.' + - label: 'Enterprise' + value: 'enterprise' + description: 'Ideal for larger teams and organizations.' +--- +:: + ### Legend Use the `legend` prop to set the legend of the RadioGroup. diff --git a/playground/app/pages/components/radio-group.vue b/playground/app/pages/components/radio-group.vue index 3cb3c00833..6c81abbd3e 100644 --- a/playground/app/pages/components/radio-group.vue +++ b/playground/app/pages/components/radio-group.vue @@ -2,6 +2,8 @@ import theme from '#build/ui/radio-group' const sizes = Object.keys(theme.variants.size) as Array +const variants = Object.keys(theme.variants.variant) +const variant = ref('radio' as const) const literalOptions = [ 'Option 1', @@ -23,27 +25,30 @@ const itemsWithDescription = [ diff --git a/src/runtime/components/RadioGroup.vue b/src/runtime/components/RadioGroup.vue index 07a9d8faba..af1cdcc740 100644 --- a/src/runtime/components/RadioGroup.vue +++ b/src/runtime/components/RadioGroup.vue @@ -50,6 +50,7 @@ export interface RadioGroupProps extends Pick } @@ -85,7 +86,9 @@ const props = withDefaults(defineProps>(), { const emits = defineEmits() const slots = defineSlots>() -const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'loop', 'required'), emits) +const modelValue = defineModel() + +const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultValue', 'orientation', 'loop', 'required'), emits) const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled, ariaAttrs } = useFormField>(props, { bind: false }) const id = _id.value ?? useId() @@ -95,7 +98,8 @@ const ui = computed(() => radioGroup({ color: color.value, disabled: disabled.value, required: props.required, - orientation: props.orientation + orientation: props.orientation, + variant: props.variant })) function normalizeItem(item: any) { @@ -140,8 +144,8 @@ function onUpdate(value: any) {