Choice list

DarkInspect

A single choice with every option in view: a Radio group whose rows carry an icon, a title, a price and a line of detail, and whose whole row is the hit target. It is the answer when the options are few enough to read at once: the sell form's condition, the checkout's delivery and payment. When they are not (a category, a brand, a size), the question is a Floating row that opens a list.

Examples

Layouts

One list, three chromes, picked with layout:

  • list (the default): divided rows on the panel they sit in, with a hover, for a column of comparable options (carriers, pick-up points, payment methods).
  • group: the rows in one card of their own on a bare page, so the options read as one question, as a FloatingRowGroup's pickers do beside them. No hover fill; the chosen row tints.
  • cards: a card per option, for the two or three a decision turns on. The chosen card is the only one that draws an edge, and it tints.
DarkInspect

In the checkout

The checkout's delivery decision is cards, the real component: a closed option stays in view, disabled, and says why, so the buyer learns it exists.

DarkInspect

States

disabled on an item closes it; children in ChoiceItemControl replace the radio (a spinner while the choice saves); OptionRow is the same row as a button, for a row that does something rather than picking (it ends in a chevron); ChoiceListSkeleton holds the list's place while the options load, in the same boxes.

DarkInspect

Anatomy

<ChoiceList layout="cards" value={value} onValueChange={setValue}>
  <ChoiceItem value="home">
    <ChoiceItemIcon>
      <IconHome />
    </ChoiceItemIcon>
    <ChoiceItemTitle>Ship to home</ChoiceItemTitle>
    <ChoiceItemPrice>from €4.99</ChoiceItemPrice>
    <ChoiceItemDescription>1 to 3 days</ChoiceItemDescription>
    <ChoiceItemControl />
  </ChoiceItem>
</ChoiceList>
  • ChoiceList is the root: Base UI's RadioGroup, controlled through value or uncontrolled from defaultValue, and the layout every row reads.
  • ChoiceItem is one option: the <label> enclosing its radio.
  • The row is a grid of named areas (icon, title, price, description, control), so the parts can be written in any order, and a part that is not rendered leaves no gap.
  • ChoiceItemTitle truncates on one line, SemiBold; ChoiceItemPrice has a line of its own under it, since a price is what the eye runs down a list for.
  • Every item ends in a ChoiceItemControl: empty, the radio; with children, those.