Sprout Menu

Sprout Menu is a floating trigger button that, when opened, grows curved branches out to a fan of circular sub-action buttons and retracts them when it closes. It is built on Motion for the branch-drawing and staggered spring animations, and uses lucide-react for the default icons.

Sprout Menu
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @glint-ui/sprout-menu

Requires @glint-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { SproutMenu } from '@/components/ui/sprout-menu';export default function Page() {  return <SproutMenu />;}
  • Use as a floating or contextual action launcher, such as a 'Create' or 'Add' button that reveals several quick actions.
  • Use when a playful, organic expanding-menu interaction suits the product, for example a mobile-friendly speed-dial or media-attach menu.
  • Use when you have roughly 2 to 6 short actions that can be represented by icons with short labels.
  • Avoid for long lists or dense navigation, since the items are arranged on a fixed arc with limited space.

Examples

Default menu

Renders the trigger with the five built-in items (Photo, Gallery, Note, Voice, Place) and the default lime branch color.

default-menu.tsx
import { SproutMenu } from '@/components/ui/sprout-menu';export function Default() {  return <SproutMenu />;}

Custom items with selection handler

Passes custom items with lucide icons and tracks the last chosen action. The menu collapses automatically after onSelect runs.

custom-items-with-selection-handler.tsx
import { useState } from 'react';import { Share2, Pencil, Trash2 } from 'lucide-react';import { SproutMenu, type SproutMenuItem } from '@/components/ui/sprout-menu';const items: SproutMenuItem[] = [  { label: 'Share', icon: <Share2 /> },  { label: 'Edit', icon: <Pencil /> },  { label: 'Delete', icon: <Trash2 /> },];export function FileActions() {  const [last, setLast] = useState<string | null>(null);  return (    <div className='flex flex-col items-center gap-4'>      <SproutMenu items={items} label='File actions' onSelect={(item) => setLast(item.label)} />      <p className='text-sm text-muted-foreground'>{last ? `Last: ${last}` : 'Pick an action'}</p>    </div>  );}

Custom radius, spread, and color

Tightens the arc and changes the branch color to blue, with a custom accessible label for the trigger.

custom-radius,-spread,-and-color.tsx
import { SproutMenu } from '@/components/ui/sprout-menu';export function Compose() {  return <SproutMenu color='#60a5fa' radius={110} spread={120} label='Compose' />;}

Fixed floating placement

Pins the menu to the bottom-right corner of the viewport and scales it down using className.

fixed-floating-placement.tsx
import { SproutMenu } from '@/components/ui/sprout-menu';export function FloatingLauncher() {  return (    <div className='fixed bottom-6 right-6 z-50'>      <SproutMenu className='scale-90' />    </div>  );}

API reference

PropTypeDefaultDescription
itemsSproutMenuItem[]defaultItems (Photo, Gallery, Note, Voice, Place)Sub-actions that sprout at the ends of the branches. Each item has a label (used as the accessible name and tooltip) and an optional icon ReactNode.
radiusnumber130Branch length in px.
spreadnumber150Fan angle in degrees across which the branches spread.
colorstring'#a3e635'Branch stroke color. Also tints the item glow shadows.
labelstring'Create'Accessible name of the trigger and the menu's aria-label.
onSelect(item: SproutMenuItem, index: number) => void—Called with the chosen item and its index; the menu then collapses and focus returns to the trigger.
classNamestring—Additional classes applied to the root container, which has a fixed width and height derived from radius.

Accessibility

  • The trigger is a button with aria-haspopup='menu', aria-expanded reflecting open state, and aria-controls pointing to the menu when open.
  • Sub-actions use role='menuitem' inside a role='menu' container labeled by the label prop. Each item's visible text is also available to screen readers via a visually hidden span.
  • Keyboard support: opening focuses the first item; ArrowRight/ArrowDown and ArrowLeft/ArrowUp move focus with wrap-around, Home and End jump to the first and last items, Escape closes the menu and returns focus to the trigger.
  • Focus leaving the root container closes the menu.
  • Motion respects the user's reduced-motion setting through MotionConfig reducedMotion='user'.
  • The decorative SVG branches are aria-hidden, and visible tooltip labels are aria-hidden to avoid duplicate announcements.
  • Items have a visible focus ring (focus-visible:ring-[3px]) and the trigger has a focus ring with offset.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Sprout Menu" component (glint-ui/sprout-menu) from its shadcn registry.1. Install it with: npx shadcn@latest add @glint-ui/sprout-menu2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: items, radius, spread, color, label, onSelect, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { SproutMenu } from '@/components/ui/sprout-menu';export default function Page() {  return <SproutMenu />;}```

Files & dependencies

  • registry/ui/sprout-menu.tsx
dependenciesmotionlucide-react

Looks similar, elsewhere