TuMarca

Radio Group

A set of checkable buttons where only one can be checked at a time.

stable
Tipo: ui
Versión: 1.0.0
form form input selection vanilla-js
🚀 saastro/ui (Astro)
⚛️ shadcn/ui (React)

Installation

npx saastro add radio-group

Usage

---
import { RadioGroup, RadioGroupItem } from "@/components/ui-saastro/radio-group";
---

<RadioGroup name="example" defaultValue="option-one">
  <div class="flex items-center space-x-2">
    <RadioGroupItem value="option-one" id="option-one" />
    <label for="option-one">Option One</label>
  </div>
  <div class="flex items-center space-x-2">
    <RadioGroupItem value="option-two" id="option-two" />
    <label for="option-two">Option Two</label>
  </div>
</RadioGroup>

Props

RadioGroup

PropTypeDefaultDescription
namestring-Name attribute for the radio inputs
defaultValuestring-Initially selected value
orientation"vertical" | "horizontal""vertical"Layout direction

RadioGroupItem

PropTypeDefaultDescription
valuestringRequiredValue for this option
idstring-ID for label association
disabledbooleanfalseDisable the option