Menu, categories
betaA restaurant's menu by category, in tabs: each dish with its description, tags and price in the local currency.
npx rasengan-ui add menu-categories
- Use it
- A restaurant, a café or a bakery with a menu of up to a hundred items.
- Avoid it
- A menu that changes daily: link to a photo or a PDF instead.
- Pairs with
- Gallery, gridOrder, banner
Installation
It installs into components/blocks/menu-categories/, with what it uses (Tabs, Badge) and lib/blocks.ts.
Usage
Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):
Prices are formatted with Intl.NumberFormat in locale: { amount: 4500, currency: "XAF" } reads "FCFA 4,500" in en-CM and "4 500 FCFA" in fr-CM. Every category stays in the HTML (keepMounted), so search engines read the whole menu.
Content
| Field | Type | Limits | Guidance |
|---|---|---|---|
title | string | 2–48 chars | Usually 'Our menu' or 'The menu'. |
sublineoptional | string | ≤ 160 chars | A line about the food: where it comes from, what changes. |
categories | object[] | 1–8 items | In the order of a meal. Each category is a tab. |
categories[].name | string | 2–24 chars | 'Starters', 'Grills', 'Drinks'. |
categories[].items | object[] | 1–16 items | |
categories[].items[].name | string | 1–48 chars | |
categories[].items[].descriptionoptional | string | ≤ 140 chars | |
categories[].items[].price | object | ||
categories[].items[].price.amount | number | ≥ 0 | |
categories[].items[].price.currency | string | 3–3 chars | An ISO 4217 code: 'EUR', 'USD', 'XAF'. |
categories[].items[].tagsoptional | string[] | ≤ 3 items | Short labels: 'spicy', 'vegetarian', 'new'. |
localeoptional | string | A BCP 47 locale for prices ('en-CM'); the page's language when left out. | |
noteoptional | string | ≤ 140 chars | Under the menu: allergens, service, prices including taxes. |
Props
| Prop | Notes |
|---|---|
content | MenuCategoriesContent; the example when left out |
id | the section's id, for anchor links; "menu" by default |
headingLevel | 1, 2 or 3: the heading's tag; 2 by default |
className | on the <section>, for spacing |
Accessibility
- Each category is a tab panel with a hidden heading, so the outline lists the categories.
- Dishes are a list; the dotted leader between a name and its price is decorative.