Skip to content

Conversation

@twjeffery
Copy link
Collaborator

@twjeffery twjeffery commented Oct 15, 2025

Summary

Updates the Radio component (RadioGroup + RadioItem) to support V2 design
system styling while maintaining full backward compatibility with V1. This
is a Token+CSS+Logic implementation due to the fundamental visual
pattern change requiring DOM structure updates.

Changes

RadioGroup Component

New Props:

  • version ("1" | "2", default "1"): Controls V1 vs V2 styling
  • size ("default" | "compact", default "default"): Controls
    spacing between radio items

Size Variants:

  • Default vertical gap: 16px (unchanged from V1)
  • Compact vertical gap: 12px (new)
  • Default horizontal gap: 32px (increased from 24px)
  • Compact horizontal gap: 24px (new)

Implementation:

  • Version and compact state passed to RadioItem children via event
    messaging
  • Reactive block ensures size/version changes propagate immediately
  • CSS scoped with .v2.compact for V2-only features

RadioItem Component

Visual Pattern Change (V1 → V2):

V1 Approach (Border-Based):

  • Uses thick 7px border to create "filled circle" appearance when checked
  • Simple DOM structure: .icon div directly in label

V2 Approach (Border + Inner Dot):

  • Uses thin 1.5px border + separate 16px inner dot element when checked
  • Enhanced DOM structure: .icon-wrapper > .icon + .icon-inner
    (conditional)
  • Inner dot absolutely positioned and centered using transform: translate(-50%, -50%)

New Props:

  • version (received from RadioGroup): Controls V1/V2 rendering
  • compact (received from RadioGroup): Controls typography sizing

State Styling Updates:

All interaction states properly tokenized across 12+ combinations:

  • Unchecked: default, hover, focus, hover+focus, disabled
  • Checked: default, hover, focus, hover+focus, disabled
  • Error states: unchecked + checked with all interaction combinations

V2-Specific Features:

  • Inner dot colors: Blue (default), dark blue (hover), grey (disabled),
    red (error)
  • Background colors: Light grey (disabled), light red (error), pink (error
    hover)
  • Gap spacing: 12px icon-to-label (default), 8px (compact)
  • Typography: Medium weight (500), 22px line-height

Size Variants:

  • Default: 18px label, medium weight
  • Compact: 16px label, medium weight

Related

@twjeffery twjeffery linked an issue Oct 15, 2025 that may be closed by this pull request
@twjeffery twjeffery marked this pull request as ready for review October 15, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radio input 2.0 update

2 participants