PeakUIPro

CellSelect

Compact select styled as a settings cell

Usage

import {CellSelect} from "@peakui-pro/react";

Anatomy

The list inside the popover composes the core ListBox, whose items carry the checkmarks.

import {CellSelect} from "@peakui-pro/react";
import {ListBox} from "@peakui/react";

// Rendered as: the Trigger (a <button>), the Label leading, the Value after it,
// the Indicator last, and the Popover's list below the row's end.
export default () => (
  <CellSelect aria-label="Theme" defaultSelectedKey="default">
    <CellSelect.Trigger>
      <CellSelect.Label>Theme</CellSelect.Label>
      <CellSelect.Value />
      <CellSelect.Indicator />
    </CellSelect.Trigger>
    <CellSelect.Popover>
      <ListBox>
        <ListBox.Item id="default" textValue="Default">
          Default
          <ListBox.ItemIndicator />
        </ListBox.Item>
      </ListBox>
    </CellSelect.Popover>
  </CellSelect>
);

Examples

Variants

variant restyles the row and its fill together.

Controlled

Settings Group

The row's leading label names the select; the cell fills the value column.

Custom Value

Font Family

Dynamic Items

A Collection with items inside the ListBox builds the list from data.

Disabled

Customization

Tailwind CSS

<CellSelect aria-label="Theme" className="w-full">
  <CellSelect.Trigger>…</CellSelect.Trigger>
</CellSelect>

Global CSS

@layer components {
  /* The row's surface; the secondary variant swaps tone for shadow. */
  .cell-select__trigger {
    @apply rounded-lg;
  }
}

Styling Reference

PeakUI follows the BEM methodology, so variants and states are plain class names you can target.

CSS Classes

The CellSelect component uses these CSS classes (view source styles):

Base Classes

  • .cell-select - The root; fills the row a settings table gives it

Element Classes

  • .cell-select__trigger - The visible cell row; a surface 36px high with the label leading
  • .cell-select__trigger--default - The default trigger variant
  • .cell-select__trigger--secondary - A quieter row: bg-default-soft with no surface shadow
  • .cell-select__label - The leading label; takes half the row's room and truncates
  • .cell-select__value - The selected value; muted, end-aligned, takes the trailing half
  • .cell-select__indicator - The chevrons glyph at the row's end; in flow at 12px
  • .cell-select__popover - The popover the list opens in; the core Select's own beside the cell's name

Slots

  • [data-slot="cell-select"] - The root element
  • [data-slot="cell-select-trigger"] - The row
  • [data-slot="cell-select-label"] - The label
  • [data-slot="cell-select-value"] - The value
  • [data-slot="cell-select-indicator"] - The indicator; a custom child element takes the slot onto itself
  • [data-slot="cell-select-popover"] - The popover

API Reference

CellSelect

PropTypeDefaultDescription
variant'default' | 'secondary''default'The cell's own variant axis; it shadows the core Select's, which the cell does not take
childrenReactNode-The parts
classNamestring-Additional classes
renderDOMRenderFunction<'div', SelectRenderProps>-Replaces the rendered <div> with your own element
...restComponentProps<typeof SelectRoot>-The core Select root's props: selectedKey, defaultSelectedKey, onSelectionChange, isDisabled, aria-label, items and the rest of React Aria's Select attributes

CellSelect.Trigger

PropTypeDefaultDescription
childrenReactNode | ((values) => ReactNode)-The row's content — the Label, the Value and the Indicator
classNamestring-Additional classes
renderDOMRenderFunction<'button', ButtonRenderProps>-Replaces the rendered <button> with your own element
...restComponentProps<typeof SelectTrigger>-The core Select.Trigger's props, React Aria's Button attributes among them

CellSelect.Value

PropTypeDefaultDescription
childrenReactNode | ((values) => ReactNode)-Custom content; the selected item's text renders without it. As a function it receives the selected item
classNamestring-Additional classes
renderDOMRenderFunction<'span', SelectValueRenderProps>-Replaces the rendered <span> with your own element
...restComponentProps<typeof SelectValue>-The core Select.Value's props, React Aria's SelectValue attributes among them

CellSelect.Indicator

PropTypeDefaultDescription
childrenReactNode-A custom indicator element; it takes the classes, the slot and the open state onto itself
classNamestring-Additional classes
renderDOMRenderFunction<'span', undefined>-Replaces the rendered element with your own; the default child is the IconChevronsExpandVertical glyph
...restComponentProps<'span'>-Native <span> attributes, handed to the indicator element

CellSelect.Popover

PropTypeDefaultDescription
childrenReactNode-The list; composes the core ListBox
placementPlacement'bottom end'Where the list lands; the core's own default is 'bottom'
classNamestring-Additional classes
renderDOMRenderFunction<'div', PopoverRenderProps>-Replaces the rendered <div> with your own element
...restComponentProps<typeof SelectPopover>-The core Select.Popover's props, React Aria's Popover attributes among them

CellSelect.Label

PropTypeDefaultDescription
childrenReactNode-The label text
classNamestring-Additional classes
renderDOMRenderFunction<'span', undefined>-Replaces the rendered <span> with your own element
...restComponentProps<'span'>-Native <span> attributes

On this page