0.04K

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

import { Label } from '@/components/ui/label';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';

<template>
  <RadioGroup @defaultValue="comfortable">
    <div class="flex items-center gap-3">
      <RadioGroupItem @value="default" id="r1" />
      <Label @for="r1">Default</Label>
    </div>
    <div class="flex items-center gap-3">
      <RadioGroupItem @value="comfortable" id="r2" />
      <Label @for="r2">Comfortable</Label>
    </div>
    <div class="flex items-center gap-3">
      <RadioGroupItem @value="compact" id="r3" />
      <Label @for="r3">Compact</Label>
    </div>
  </RadioGroup>
</template>

Installation

pnpm dlx shadcn-ember@latest add radio-group

Usage

import { Label } from '@/components/ui/label';
import { RadioGroup } from '@/components/ui/radio-group';
<RadioGroup @defaultValue="option-one" as |rg|>
  <div class="flex items-center gap-3">
    <rg.Item @value="option-one" id="option-one" />
    <Label @for="option-one">Option One</Label>
  </div>
  <div class="flex items-center gap-3">
    <rg.Item @value="option-two" id="option-two" />
    <Label @for="option-two">Option Two</Label>
  </div>
</RadioGroup>