Trên trang này

Trang này chưa có bản tiếng Việt, nội dung bên dưới là bản tiếng Anh. Xem trang tiếng Anh

Radio group

Install, props and the parts Radio group is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/radio-group.json

Use

<script setup lang="ts">
import { ref } from 'vue'
import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
const plan = ref('monthly')
</script>

<template>
  <div>
    <RadioGroup v-model="plan" aria-label="Billing">
      <div class="flex items-center gap-2"><RadioGroupItem id="m" value="monthly" /><Label for="m">Monthly</Label></div>
      <div class="flex items-center gap-2"><RadioGroupItem id="y" value="yearly" /><Label for="y">Yearly</Label></div>
    </RadioGroup>
  </div>
</template>

Props

Part Prop Values Notes
RadioGroup v-model string The chosen value
RadioGroupItem value, disabled string, boolean

Built on

reka-ui RadioGroupRoot and RadioGroupItem, as the shadcn-vue Radio group.