Back to Tooljet

RadioGroup — Rocket Design Spec

frontend/src/components/ui/Rocket/RadioGroup/RadioGroup.spec.md

3.20.154-lts2.8 KB
Original Source

RadioGroup — Rocket Design Spec

<!-- figma: https://www.figma.com/design/XQdM9x8x9YHcj1lUK8abUG/Rocket-components?node-id=93-52292 --> <!-- synced: 2026-04-07 -->

Overview

Single-selection group of radio inputs. Wraps Radix RadioGroup via shadcn. The visual design mirrors Checkbox but uses circular shapes — same sizes, same color tokens, same focus/disabled states.

Two sub-components:

  • RadioGroup — group container, manages selection state
  • RadioGroupItem — individual radio circle

Label is not baked in — consumers compose <label> + <RadioGroupItem>.

Props

RadioGroup

PropTypeDefault
valuestring
defaultValuestring
onValueChangefunction
disabledbooleanfalse
namestring
classNamestring

RadioGroupItem

PropTypeValuesDefault
sizestringlarge | defaultdefault
valuestring (required)
disabledbooleanfalse
classNamestring

Sizes

ValueBoxInner dot
default16px (tw-size-4)small filled circle
large20px (tw-size-5)small filled circle

Token Mapping

ElementStateFigma tokenToolJet class
bgunchecked--bg-surface-layer-01tw-bg-background-surface-layer-01
borderuncheckedborder/defaulttw-border-solid tw-border tw-border-border-default
bgcheckedbutton/primarydata-[state=checked]:tw-bg-button-primary
bordercheckedbutton/primarydata-[state=checked]:tw-border-button-primary
inner dotcheckedicon/on-solid (white)tw-bg-text-on-solid
bgdisabledcontrols/base-inactivedisabled:tw-bg-controls-base-inactive disabled:tw-border-transparent
focus ringfocusedinteractive/focusActivefocus-visible:tw-ring-2 focus-visible:tw-ring-interactive-focus-outline focus-visible:tw-ring-offset-2
cursordisableddisabled:tw-cursor-not-allowed

CVA Shape

Shape C — sizes only, applied to RadioGroupItem.

Notes

  • Wraps Radix RadioGroup.Root + RadioGroup.Item + RadioGroup.Indicator via shadcn.
  • Both circular: tw-rounded-full for default and large.
  • Inner dot rendered via <RadioGroup.Indicator> containing a smaller filled circle.
  • Inner dot size: tw-size-1.5 (6px) for default, tw-size-2 (8px) for large.
  • RadioGroup wrapper provides selection state via Radix context — items must be wrapped in a RadioGroup.
  • Disabled state: bg becomes controls-base-inactive (subtle gray), border removed (transparent).
  • Same token tokens as Checkbox — consistent UX across binary controls.
  • Consumer composes label: <label className="tw-flex tw-items-center tw-gap-2"><RadioGroupItem value="x" /> <span>Label</span></label>.