Design system

Cascader Item

A row in a cascading picker, where choosing a table opens its columns.

import { CascaderItem } from "@/ui";

Cascader Item matches the Figma Cascader Component. It is one row of a picker that goes from a source's tables to their columns, like choosing the columns a definition or analysis should use. Stack rows in a list; each row draws its own line underneath.

Tables and columns

Click a table to open its columns. The open table is selected: Primary 50 fill, a 3px blue bar on the left and a medium label. Tick columns from anywhere on the row. The count on each table is how many of its columns are ticked.

{tables.map((t) => (
  <CascaderItem
    key={t.id}
    label={t.label}
    logo={t.logo}
    count={picked[t.id]?.length || undefined}
    selected={t.id === open}
    onClick={() => setOpen(t.id)}
  />
))}

{table.columns.map((c) => (
  <CascaderItem
    key={c.id}
    type="column"
    label={c.label}
    tag={c.id}
    info={c.info}
    checked={picked.includes(c.id)}
    onCheckedChange={(on) => toggle(c.id, on)}
  />
))}

History

type="history" shows a clock icon and a time on the right, for recently used tables and columns. Long labels are cut off with an ellipsis.

<CascaderItem type="history" label="Accounts" time="2:01 PM" selected />
<CascaderItem type="history" label="Account ID" tag="AccountId" time="1:47 PM" count={2} />

Variants

Figma propertyProp
Type: Tabletype="table" (default), ends in a caret
Type: Columntype="column", ends in an info icon when info is set
Type: History / History (Tag)type="history" with time, plus tag for the tag version
Icon: Sourcelogo (a 16px image)
Icon: Check Boxchecked and onCheckedChange
Icon: HistoryAdded for type="history"
Icon: NoneLeave out logo and checked
Indicator: Enabledcount
State: Rest (Selected)selected

Hover looks the same with or without selected, as in Figma.

Anatomy

PartSizeStyle
Row46px tall, 12px × 16px padding (history 12px)White, 1px Grey 100 line below
HoverPrimary 50 fill
SelectedPrimary 50 fill, 3px Primary 500 bar on the left drawn inside the row
Label14px / 22px--color-text-primary; medium when a table or history row is selected
Leading icon16px, 8px gapLogo, checkbox or Grey 900 clock
TagSmall Tag in the Column colourThe column's API name
Count16px tall, 6px sides, 6px radiusPrimary 500 with white 12px text
Caret / info16px, 12px after the countGrey 300, Grey 600 when selected
Time12px / 19px--color-text-secondary

Props

PropTypeDefaultNotes
type"table" | "column" | "history""table"
labelstring
tagstringColumn API name.
logostringImage URL for the source logo.
checkedbooleanSetting it shows a checkbox.
onCheckedChange(checked) => void
countnumber | string
infostringColumn description for the info icon.
timestringHistory rows.
selectedbooleanfalseThe row whose next level is showing.
onClick(e) => void
classNamestringOther props are passed to the root too.

Differences from Figma

  • Tag and count text is 12px, not 10px.
  • The info icon shows the column description as a browser tooltip. Figma doesn't show what it opens.
  • Figma's checkbox rows are never ticked. Ticked rows use the Checkbox checked style.

Accessibility

  • Rows without a checkbox are buttons. The selected one has aria-current="true".
  • In checkbox rows the checkbox is the control: it is named by the label and described by info. Clicking anywhere else on the row toggles it too.
  • The info text is also in the page for screen readers, linked with aria-describedby.

Do and don't

  • Do show the source logo on table rows when the picker mixes sources.
  • Do use count to show how many columns are picked in each table, so people can see their picks without opening every table.
  • Don't use it for a short menu of actions. Use Dropdown Panel.

On this page