Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

Radio

A radio button for choosing one option from several. Used within a radio group.

View in Storybook (opens in a new tab)

Installation

import { Radio } from "@ginga-ui/core";

Basic usage

A simple radio group example.

radio.tsx
import { Radio, RadioGroup } from "@ginga-ui/core";

export function BasicExample() {
  return (
    <RadioGroup>
      <Radio value="option1">Option 1</Radio>
      <Radio value="option2">Option 2</Radio>
      <Radio value="option3">Option 3</Radio>
    </RadioGroup>
  );
}

Default value

A radio group with an initially selected value.

radio.tsx
import { Radio, RadioGroup } from "@ginga-ui/core";

export function DefaultValueExample() {
  return (
    <RadioGroup defaultValue="option2">
      <Radio value="option1">Option 1</Radio>
      <Radio value="option2">Option 2 (selected by default)</Radio>
      <Radio value="option3">Option 3</Radio>
    </RadioGroup>
  );
}

Disabled

A radio group with some options disabled.

radio.tsx
import { Radio, RadioGroup } from "@ginga-ui/core";

export function DisabledExample() {
  return (
    <RadioGroup>
      <Radio value="option1">Option 1</Radio>
      <Radio value="option2" disabled>
        Option 2 (disabled)
      </Radio>
      <Radio value="option3">Option 3</Radio>
    </RadioGroup>
  );
}

Controlled radio group

A radio group whose state is controlled externally.

radio.tsx
import { Radio, RadioGroup } from "@ginga-ui/core";

export function ControlledExample() {
  return (
    <RadioGroup onChange={(value) => console.log("Selected:", value)}>
      <Radio value="small">Small</Radio>
      <Radio value="medium">Medium</Radio>
      <Radio value="large">Large</Radio>
    </RadioGroup>
  );
}

Props

RadioGroup

NameTypeDefaultDescription
disabledbooleanfalseDisables every radio button in the group.
requiredbooleanfalseRequires a selection.
readOnlybooleanfalsePrevents the user from changing the selection.
invalidbooleanfalseShows the group as invalid.

Also accepts the props of React Aria's RadioGroup (opens in a new tab).

Radio

NameTypeDefaultDescription
disabledbooleanfalseDisables the radio button.

Also accepts the props of React Aria's Radio (opens in a new tab).