Corpora UI
Atoms

Radio group

Choose one option from a labeled set.

Usage

Import the stylesheet once at the application root: @exegia/corpora-ui/index.css.

import { RadioGroup, Radio } from "@exegia/corpora-ui/ui/radio-group"

function ComponentPreview({ disabled }: { disabled: boolean }) {

  return (
    <div className="relative mx-auto w-full max-w-lg p-6">
      <RadioGroup defaultValue="text" disabled={disabled} aria-label="Export format"><label className="flex items-center gap-2"><Radio value="text" />Plain text</label><label className="flex items-center gap-2"><Radio value="json" />JSON</label></RadioGroup>
    </div>
  )
}

<ComponentPreview {...{ disabled: false }} />

API notes

value and onValueChange control the selected option. defaultValue initializes it. Each Radio needs a distinct value and a visible label.

Last updated on

On this page