Modus UI

Tray Picker

Web (React)

A compact select whose tray slides open from its chip with serif options.

Tray Picker expands a single chip into a tray of options, keeps full keyboard support and sets each option in the Modus serif. Surfaces and highlights follow the active palette.

Modus / Tray Picker

Installation

CLI

npx @modus-ui/cli add tray-picker

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/tray-picker.tsx.
  3. Paste the code.

Usage

tsx
import { TrayPicker } from "@/components/ui/tray-picker";

export default function Example() {
  return <TrayPicker />;
}

Props

PropTypeDefaultDescription
optionsanyDEFAULT_OPTIONSOptions, as strings or option objects.
valueany-Controlled selected value.
defaultValueany-Initial value when uncontrolled.
onChangeany-Called with the new value and option.
placeholderstring"Choose a face…"Text shown when nothing is selected.
showTagsbooleantrueShow option tags in the menu.
accentColorstring"hsl(var(--foreground))"Accent colour for the selection.
surfaceColorstring"hsl(var(--card))"Trigger and menu surface colour.
highlightColorstring"hsl(var(--muted))"Colour of the gliding highlight.
textColorstring"hsl(var(--foreground))"Text colour.
sizestring"md"Trigger size: "sm", "md" or "lg".
radiusnumber10Corner radius in pixels.
menuWidthnumber176Menu width in pixels.
placementstring"bottom"Open the menu "bottom" or "top".
alignstring"left"Align the menu "left" or "right".
popDurationnumber180Menu open duration in milliseconds.
glideDurationnumber220Highlight glide duration in milliseconds.
rememberPositionbooleantrueKeep the highlight on the last hovered option.
disabledbooleanfalseDisables the picker.
ariaLabelstring"Choose"Accessible label for the trigger.

Comments

  • No comments yet.