Skip to content
New

Menu, categories

beta

A 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.
Built with
TabsBadge

Installation

Terminal
npx rasengan-ui add menu-categories

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):

app/_routes/index.page.tsx
import { MenuCategories } from "@/components/blocks/menu-categories";
import { home } from "@/content/home";
 
export default function Home() {
  return <MenuCategories content={home.menu} />;
}
content/home.ts
import { example, type MenuCategoriesContent } from "@/components/blocks/menu-categories";
 
export const home = {
  menu: {
    ...example,
    title: "Our menu",
  } satisfies MenuCategoriesContent,
};

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

FieldTypeLimitsGuidance
titlestring2–48 charsUsually 'Our menu' or 'The menu'.
sublineoptionalstring≤ 160 charsA line about the food: where it comes from, what changes.
categoriesobject[]1–8 itemsIn the order of a meal. Each category is a tab.
categories[].namestring2–24 chars'Starters', 'Grills', 'Drinks'.
categories[].itemsobject[]1–16 items
categories[].items[].namestring1–48 chars
categories[].items[].descriptionoptionalstring≤ 140 chars
categories[].items[].priceobject
categories[].items[].price.amountnumber≥ 0
categories[].items[].price.currencystring3–3 charsAn ISO 4217 code: 'EUR', 'USD', 'XAF'.
categories[].items[].tagsoptionalstring[]≤ 3 itemsShort labels: 'spicy', 'vegetarian', 'new'.
localeoptionalstringA BCP 47 locale for prices ('en-CM'); the page's language when left out.
noteoptionalstring≤ 140 charsUnder the menu: allergens, service, prices including taxes.

Props

PropNotes
contentMenuCategoriesContent; the example when left out
idthe section's id, for anchor links; "menu" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
classNameon 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.