Back to Tooljet

ToggleGroup — Rocket Design Spec

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

3.20.154-lts3.3 KB
Original Source

ToggleGroup — Rocket Design Spec

<!-- figma: https://www.figma.com/design/XQdM9x8x9YHcj1lUK8abUG/Rocket-components?node-id=7406-50531 --> <!-- synced: 2026-03-18 -->

Props

ToggleGroup (container)

PropTypeValuesDefault
typestringsingle | multiplesingle
sizestringlarge | default | medium | smalldefault
valuestring | string[]controlled
defaultValuestring | string[]uncontrolled default
onValueChangefunctioncallback
disabledbooleanfalse
classNamestring

ToggleGroupItem

PropTypeValuesDefault
valuestringitem identifier (required)
sizestringlarge | default | medium | smallinherits from group
disabledbooleanfalse
classNamestring
childrenReactNodetext label or icon

Layout

┌─ container (grey pill, 2px padding, rounded-md) ──────────────────┐
│ [active item ▪ white bg + shadow]  [inactive]  [inactive]  [inactive] │
└───────────────────────────────────────────────────────────────────┘
  • Container: tw-bg-interactive-default, tw-p-0.5, tw-rounded-md
  • Items: tw-rounded-[5px], padding varies by size
  • Icon size: 18×18

Sizes

ValueItem heightTailwind
large36pxtw-h-9 tw-px-2.5 tw-text-lg
default28pxtw-h-7 tw-px-1.5 tw-text-base
medium24pxtw-h-6 tw-px-1.5 tw-text-base
small20pxtw-h-5 tw-px-1 tw-text-sm

Size is set on ToggleGroup and flows to items via React context. Items can override individually.

Token Mapping

Container

ElementFigma tokenToolJet class
backgroundInteractive/defaulttw-bg-interactive-default
padding2pxtw-p-0.5
border-radius6pxtw-rounded-md

Item — active (data-[state=on])

ElementFigma tokenToolJet class
background--bg-surface-layer-01data-[state=on]:tw-bg-background-surface-layer-01
shadowElevations/100data-[state=on]:tw-shadow-elevation-100
text colortext/defaultdata-[state=on]:tw-text-text-default
icon coloricon/strongdata-[state=on]:tw-text-icon-strong

Item — inactive

ElementFigma tokenToolJet class
backgroundtw-bg-transparent
text colortext/disabledtw-text-text-disabled
icon coloricon/weaktw-text-icon-weak

CVA Shape

Shape C — sizes only, no visual variants. CVA on items with size variants.

Notes

  • Segmented control pattern — NOT independent toggle buttons.
  • Uses shadcn ToggleGroup as structural base (Radix @radix-ui/react-toggle-group — manages selection state, keyboard nav, aria).
  • Single visual style — no ghost/outline variants. The container always has the grey pill appearance.
  • Active item styling is driven by Radix data-[state=on] attribute.
  • Inner border-radius is 5px (container 6px minus 2px padding = logical 4px, but Figma uses 5px explicitly).
  • Font: 12px / 18px line-height, IBM Plex Sans Medium — tw-text-base tw-font-medium.