Staaarter

Dietary Filter Menu

Interactive menu with dietary filter buttons (vegetarian, vegan, gluten-free) and allergen warnings. Perfect for health-conscious diners and inclusive restaurant menus.

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 button, badge dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/dietary-filter-menu.json

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

Usage

The file also exports food6Demo, 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 { Food6, food6Demo } from "@/components/blocks/food/food6";

export default function Page() {
  return <Food6 {...food6Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Our Menu"Section heading.
descriptionstring"Filter by dietary preference to find dishes that work for you."Section intro text.
filtersDietaryFilter[]vegetarian / vegan / gluten-freeToggleable filter buttons above the list.
itemsMenuItem[][]Menu items; each item's tags are matched against the active filters.
classNamestringnoneExtra classes for the outer section element.

Types

type DietaryFilter = { value: string; label: string };

type MenuItem = {
  name: string;
  price: string;
  description: string;
  tags?: string[];
  allergens?: string[];
};

Behavior notes

  • Real client-side filter state: any number of filters can be toggled on at once (aria-pressed reflects each button's state), and an item is only shown while every active filter's value is present in that item's tags array.
  • With no filters active, the full item list shows; if the active filters exclude every item, an explicit "No dishes match" message renders instead of an empty gap.
  • Allergen warnings are read from item.allergens and rendered next to the dietary tags with a warning icon; they are informational only and are not affected by the filter buttons.