Sections
Get Started
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Pin Input
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stepper
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Forms
A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
<script setup lang="ts">
import { Label } from '@/components/ui/label'
import {
RadioGroup,
RadioGroupItem,
} from '@/components/ui/radio-group'
</script>
<template>
<RadioGroup default-value="comfortable">
<div class="flex items-center space-x-2">
<RadioGroupItem id="r1" value="default" />
<Label for="r1">Default</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem id="r2" value="comfortable" />
<Label for="r2">Comfortable</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem id="r3" value="compact" />
<Label for="r3">Compact</Label>
</div>
</RadioGroup>
</template>Installation
pnpm dlx shadcn-vue@latest add radio-group
Usage
<script setup lang="ts">
import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
</script>
<template>
<RadioGroup default-value="comfortable">
<div class="flex items-center space-x-2">
<RadioGroupItem id="r1" value="default" />
<Label for="r1">Default</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem id="r2" value="comfortable" />
<Label for="r2">Comfortable</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem id="r3" value="compact" />
<Label for="r3">Compact</Label>
</div>
</RadioGroup>
</template>