Staaarter

Expandable Menu Accordion

Collapsible menu items revealing full images, calorie counts, protein info, and allergen badges. Perfect for detailed nutritional menus and health-focused dining.

By Staaarter Team
Food
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, media-slot dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/expandable-menu-accordion.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/food/food4.tsx instead.

Usage

The file also exports food4Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Food4, food4Demo } from "@/components/blocks/food/food4";

export default function Page() {
  return <Food4 {...food4Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Full menu"Section heading.
descriptionstring"Tap a dish to see the full nutrition breakdown."Section intro text.
itemsMenuItem[][]Menu items, each independently expandable.
classNamestringnoneExtra classes for the outer section element.

Types

type MenuItem = {
  name: string;
  price: string;
  summary: string;
  calories: number;
  protein: string;
  allergens?: string[];
  photo?: { src: string; alt: string };
};

Behavior notes

  • Real per-item expand/collapse state: each row tracks its own open/closed status in a Set, so multiple items can be open at once, and the first item is open by default.
  • Each expanded panel shows a photo (falling back to the shared placeholder when no photo prop is set), a summary, calorie/protein stats, and allergen badges when present.
  • The chevron icon rotates based on the same open/closed state driving the panel, with no separate animation state to keep in sync.