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.
On this page
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
Usage
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
| Prop | Type | Notes |
|---|---|---|
items | { id, label, icon?, hint?, onSelect?, disabled? }[] | |
label | string | Trigger name. Default "Add files and more" |
side | "top" | "bottom" | Which way it opens. Default top |
open / defaultOpen | boolean | Controlled or uncontrolled |
onOpenChange | (open: boolean) => void |
Keyboard
| Key | Action |
|---|---|
ArrowUp / ArrowDown on the plus | Open |
ArrowUp / ArrowDown | Move between options |
Home / End | First or last option |
Enter / Space | Pick |
Escape | Close and return focus to the plus |
Tab | Close |
Accessibility
- The trigger has
aria-haspopup="menu"andaria-expanded; options aremenuitems. - Pressing outside closes it.
Motion
- The bloom is a
clip-pathcircle 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.