Skip to content
Sign upGet access
MicrointeractionsAttach bloomMenu

Attach bloom

The composer's plus, opening like a flower: it turns into a cross and the menu blooms out of the button as a growing circle.

The composer's plus turns into a cross and its menu blooms out of the button, options rising into it one after another.

The plus turns a quarter into a cross and the menu blooms out of the button itself: its surface grows as a circle centred on the plus until it covers the menu, and the options rise into it one after another, nearest the button first. Closing runs the bloom back into the button, faster.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/attach-bloom.json

Usage

tsx
import { AttachBloom } from "@/components/ui/chatcn/attach-bloom"

<AttachBloom
  items={[
    { id: "upload", label: "Upload files", icon: <UploadIcon />, hint: "Up to 10", onSelect: pickFiles },
    { id: "photo", label: "Take a photo", icon: <CameraIcon />, onSelect: openCamera },
  ]}
/>

Props

PropTypeNotes
items{ id, label, icon?, hint?, onSelect?, disabled? }[]
labelstringTrigger name. Default "Add files and more"
side"top" | "bottom"Which way it opens. Default top
open / defaultOpenbooleanControlled or uncontrolled
onOpenChange(open: boolean) => void

Keyboard

KeyAction
ArrowUp / ArrowDown on the plusOpen
ArrowUp / ArrowDownMove between options
Home / EndFirst or last option
Enter / SpacePick
EscapeClose and return focus to the plus
TabClose

Accessibility

  • The trigger has aria-haspopup="menu" and aria-expanded; options are menuitems.
  • Pressing outside closes it.

Motion

  • The bloom is a clip-path circle from the plus, 300 ms in, 200 ms out. Options rise 8 px with a 2 px blur, 35 ms apart.
  • The start of the bloom is also set inline, so the menu never paints fully open for a frame first.
  • Reduced motion: a short fade.