Early bird: 30% off Dashral ProSee pricing

Dashral

Combobox

Combobox with motion: its list is the Motion edition's Command, so one highlight glides from option to option and the height follows what matches; the picked option's tick draws itself and a new value rises into the field.

$ pnpm dlx shadcn@latest add @dashral/motion-combobox

Selected value: bandung

Installation

$ pnpm dlx shadcn@latest add @dashral/motion-combobox

Adds components/dashral/motion/combobox.tsx, the Combobox it builds on (in components/dashral/), motion and the motion files every motion component shares. Or by its full URL: https://dashral.com/r/motion-combobox.json

Usage

The same as Combobox, imported from components/dashral/motion/ (with the npm package: @dashral/motion/components/combobox): swap the import and it moves.

example.tsx
import { Combobox } from "@/components/dashral/motion/combobox"

<Combobox
  label="Assignee"
  options={people}
  value={assignee}
  onValueChange={setAssignee}
  placeholder="Unassigned"
/>

Examples

Move a task

Options with icons and descriptions; type a team ("ops") to find its project, the highlight following, and the new project rises into the field.

ENG-1042

Redesign the checkout flow

Platform

Compared with Default

Default

The highlight jumps from option to option, the list's height snaps as you type, and a new value replaces the old at once.

Motion

One highlight glides from option to option, the list follows what matches, the picked option's tick draws itself, and a new value rises into the field.

How the two editions differ in general, and which to use where: Motion.

API reference

Every prop of Combobox, and every attribute of the element it renders. The Motion edition adds no props of its own.

Combobox

PropTypeDefault
options{ value, label, icon?, description?, disabled? }[]

What can be picked. Required. icon sits before the label (an avatar, a flag), also in the field once picked; description is a second line, searched too.

—
value / defaultValuestring

Picked value, controlled or initial. Picking it again clears it.

""
onValueChange(value: string) => void

Called with the new value.

—
placeholder / searchPlaceholder / emptyTextstring

Texts for the button, the search field and no results.

—
id / disabled / aria-label / className

Passed to the trigger button.

—
labelReactNode

Shown above, linked to the control.

—
descriptionReactNode

A hint under the control.

—
errorboolean | ReactNode

true shows the error style; a message also shows under the control.

—
labelActionReactNode

At the end of the label's row, e.g. a “Forgot password?” link or the current value.

—
withAsteriskboolean

Marks the label with an asterisk, e.g. alongside required.

false
classNames{ root, label, description, error, trigger, content, item }

Classes for each part.

—

Motion

  • Its list is the Motion edition's Command: one highlight glides (0.22s, a smooth curve) to the option the arrow keys or the pointer are on, the list's height glides to fit what matches as you type, and the options rise in as it opens.
  • The picked option's tick draws itself, a stroke from start to end.
  • A new value rises 8px into the field as the old one leaves upward, in the same place; clearing it brings the placeholder back the same way.
  • Its description and error come and go like the other motion fields: an error grows in under it and folds away. With reduced motion it only fades.