Morph Select

A dropdown where the trigger grows into the list as one surface.

Preview

"use client";

import { useState } from "react";
import {
  MorphSelect,
  MorphSelectContent,
  MorphSelectItem,
  MorphSelectTrigger,
  MorphSelectValue,
} from "@/components/motion/select-morph";

export function SelectMorphPreview() {
  const [value, setValue] = useState("next");
  return (
    <div className="w-56">
      <MorphSelect sound value={value} onValueChange={setValue}>
        <MorphSelectTrigger>
          <MorphSelectValue placeholder="Pick a framework" />
        </MorphSelectTrigger>
        <MorphSelectContent>
          <MorphSelectItem value="next">Next.js</MorphSelectItem>
          <MorphSelectItem value="remix">Remix</MorphSelectItem>
          <MorphSelectItem value="astro">Astro</MorphSelectItem>
          <MorphSelectItem value="vite">Vite</MorphSelectItem>
        </MorphSelectContent>
      </MorphSelect>
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/select-morph

API Reference

MorphSelect

value?
string

The selected value, for controlled use.

Default—
defaultValue?
string

The initial value when uncontrolled.

Default—
onValueChange?
((value: string) => void)

Called with the option's value when the user picks one.

Default—
disabled?
boolean

Disable the trigger so the panel cannot open. Default: false

Defaultfalse
sound?
boolean

Play open and close swishes and a select on a pick. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

MorphSelectValue

placeholder?
string

Text shown in the trigger and panel header before anything is picked. Default: "Select"

Default—
className?
string

Classes merged onto the value text.

Default—

MorphSelectTrigger

className?
string

Classes merged onto the trigger button.

Default—

MorphSelectContent

className?
string

Classes merged onto the open panel.

Default—

MorphSelectItem

value
string

Value reported when this option is picked.

Default—
disabled?
boolean

Make the option unselectable and skip it in keyboard navigation. Default: false

Defaultfalse
className?
string

Classes merged onto the option button.

Default—
Also on React Native. A panel that unfolds out of its trigger.

More in Select

Updated