Skip to content

Radio Group

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

Installation

bash
npx @galaxy-stack/nebula-cli@latest add radio-group
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add radio-group
bash
yarn dlx @galaxy-stack/nebula-cli@latest add radio-group
bash
bunx @galaxy-stack/nebula-cli@latest add radio-group
bash
# If you have installed galaxy-design globally
galaxy-design add radio-group

Usage

API Reference

Props

PropTypeDefaultDescriptionFrameworks
valuestring-Controlled selected valueAll
defaultValuestring-Uncontrolled initial valueAll
onValueChange(value: string) => void-Called when value changesAll
disabledbooleanfalseDisables the radio groupAll
requiredbooleanfalseRequires value before form submissionAll
orientation'horizontal' | 'vertical''vertical'Layout orientationAll
namestring-Name for form submissionAll
classNamestring''CSS class namesReact, React Native
classstring''CSS class namesVue, Angular, Flutter

RadioGroupItem

PropTypeDefaultDescriptionFrameworks
valuestring-Item valueAll
disabledbooleanfalseDisables the itemAll
classNamestring''CSS class namesReact, React Native
classstring''CSS class namesVue, Angular, Flutter

Usage

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

<template>
  <RadioGroup default-value="option-one">
    <div class="flex items-center space-x-2">
      <RadioGroupItem id="option-one" value="option-one" />
      <Label for="option-one">Option One</Label>
    </div>
    <div class="flex items-center space-x-2">
      <RadioGroupItem id="option-two" value="option-two" />
      <Label for="option-two">Option Two</Label>
    </div>
  </RadioGroup>
</template>

React

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

<RadioGroup defaultValue="option-one">
  <div className="flex items-center space-x-2">
    <RadioGroupItem value="option-one" id="option-one" />
    <Label htmlFor="option-one">Option One</Label>
  </div>
  <div className="flex items-center space-x-2">
    <RadioGroupItem value="option-two" id="option-two" />
    <Label htmlFor="option-two">Option Two</Label>
  </div>
</RadioGroup>

Angular

typescript
@Component({
  template: `
    <ui-radio-group [(value)]="selectedValue">
      <div class="flex items-center space-x-2">
        <ui-radio-group-item value="option-one" />
        <ui-label>Option One</ui-label>
      </div>
    </ui-radio-group>
  `
})

Bùi Trọng Hiếu (kevinbui) - MIT © 2025

Accessibility

  • Keyboard Navigation: [TODO]
  • Screen Reader: [TODO]
  • Focus Management: [TODO]
  • WCAG Compliance: WCAG 2.1 Level AA compliant

Author

Bùi Trọng Hiếu (kevinbui)

License

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Released under the MIT License.