Floating row

DarkInspect

A picker drawn as a row: Floating label input's label on a row instead of a box. Empty, the name rests at the value's size in grey; once something is picked it lifts to a caption and the answer takes the line under it. The chevron says the row opens something: on a phone a bottom drawer, on desktop a popup, the Combobox underneath either way.

Rows stack in a FloatingRowGroup, one card with a hairline between rows. It is the sell form's details card: the category first, then the category's attributes, each a row. A question whose options all fit in view is not a row: it is a Choice list in its group layout, the condition beside the details card.

Examples

States

Each state is the row with one prop. aria-invalid turns the label red rather than framing the row, so it keeps its place and its divider in the group; loading puts a spinner where the chevron was.

DarkInspect

Usage

A single pick is ComboboxResponsive with appearance="row", a multiple one MultiSelectCombobox with the same; label is the floating label (it falls back to title, the drawer's heading).

<FloatingRowGroup>
  <ComboboxResponsive
    appearance="row"
    label="Category"
    renderValue={(leaf) => (
      <>
        <span className="truncate">{leaf.name}</span>
        <span className="truncate text-sm text-muted-foreground">
          {leaf.trail}
        </span>
      </>
    )}
    searchPlaceholder="Search categories..."
    title="Select category"
    value={category}
    onValueChange={setCategory}
  >
    …
  </ComboboxResponsive>
  <ColorMultiSelect label="Colour" … />
</FloatingRowGroup>
  • A row has no clear button: picking the chosen item again lets it go.
  • A multiple pick reads as text ("Black, Grey"), not chips.
  • renderValue draws the answer. The category row gives it two lines, the leaf in full and the trail to it, since a leaf alone is often ambiguous ("Boots" sits under several roots).
  • Whatever a row renders under itself, a field error or a prompt, stays inside its own cell of the group.

Anatomy

The row is its parts, not a control, so a picker that is not a combobox can wear it. The address selector's floating layout opens its dialog from a row built this way:

<FloatingRowGroup>
  <button className={floatingRowClassName} onClick={openDialog} type="button">
    <FloatingRowText
      filled={address !== null}
      invalid={hasErrors}
      label={label}
    >
      <span className="truncate">{address?.subtitle}</span>
      <span className="truncate text-sm text-muted-foreground">
        {address?.fullAddress}
      </span>
    </FloatingRowText>
    <ItemChevron />
  </button>
</FloatingRowGroup>
  • floatingRowClassName is the row's box: its padding (so the group's dividers run to the card's edge while the text keeps the inset) and its focus tint, which stands in for a ring the group's rounded corners would clip.
  • FloatingRowText is the label and, once filled, the value under it; invalid turns the label red.
  • ItemChevron is the trailing chevron, the one every row that opens something ends in.
  • FloatingRowGroup is the card around the rows.