Food order
A menu and the way to order from it, for a small food business that takes orders on WhatsApp: a short note on how ordering works, a menu with a stepper on every dish you can order, and a composer that writes the order as a plain message (day with notice, time of day, delivery or pickup, area, name, notes), shows the exact words, and opens WhatsApp with them already in the box.
quiet warm playful
Open the live demo
npx @susegad/cli add food-order
Stands on: Core, Core: components, Engine, Field (TextField, TextArea, Select), Menu, Tokens, WhatsApp order
The prompt
the prompt
A menu and a way to order from it, for a small food business that takes orders on WhatsApp.
The prompt
Build the ordering page for a small food business (a café, a home baker, a shack) whose customers today send their orders as direct messages and keep asking "how do I order?". Make it from Susegad UI parts only. Open with the shop's name, a heading ("Order fresh pasta, in a few taps") and two sentences that say everything is made to order so a day's notice is needed, that the order is written for them as a WhatsApp message, and that they read it, send it, and the shop replies to confirm. Under it, "How ordering works" as a plain ordered list of three steps: choose (tap + beside each dish; prices are for one of each unit), say when and where, send it in WhatsApp (we write the message; you press send; nothing is final until we reply). Then, in two columns on a wide screen and one on a phone, the menu and the order. The menu is an <sg-menu orderable> of sections of dishes with a name, a price in rupees grouped the Indian way, a unit, a line about it and tags in words (egg-less, veg, vegan, contains nuts, spicy) with a small glyph beside each, one dish sold out and one ask-first, each dish you can order with a quantity stepper, and a total bar that stays at the foot of the screen with a link on to the order. The order is an <sg-wa-order for="menu"> with the shop's number, its name, a notice in hours, delivery areas and times of day, whose Send link is the page's one strong button. Keep the plain wa.me link inside it as the fallback, with a short generic message, so with no JavaScript the page is a readable list and one link that opens WhatsApp. Never say an order is placed. Say that the studio, the dishes and the number are made up. Let the page's register choose the look: in quiet, ruled fields and an ink-filled button; in warm, a menu card ruled by hand and the message on ruled paper in the hand; in playful, price pills and a speech bubble. Check it on a phone, with reduced motion, with JavaScript off, and by keyboard.
Words to code
| When you say | Technique | What happens |
|---|---|---|
| from Susegad UI parts only | composition | The page links the parts' CSS and imports menu.js and wa-order.js through recipe.js. The recipe's own code is the page (index.html), its layout (recipe.css) and a ready signal (recipe.js). |
| find each other | events and ids | <sg-wa-order for="menu"> listens for the menu's sg-change on the document and reads menu.order once at start. A menu nested inside the composer needs no for. |
| the page's one strong button | one link | The fallback <a class="sg-wa-send"> is the link the element upgrades; the same node is styled as the primary button with or without script. |
| readable with no JavaScript | progressive enhancement | The menu is the server's ul/li list; the composer is the one link; the steps are an ol. Steppers, fields and the preview exist only with script. |
| a day's notice | min-notice | The date field's earliest day is now plus 24 hours, in the device's time; a day inside it is refused with the earliest day named. |
| never say an order is placed | words | The steps say "Nothing is final until we reply and confirm"; the composer says only that the order is written. The check searches the whole page for "placed", "booked" and "received". |
| made up | sample content | "Sample Pasta Studio", invented dishes and a made-up number; the page says so. |
A menu and the way to order from it, for a small food business that takes its orders on WhatsApp: a café, a home baker, a shack, a stall. The page has three parts, in the order a person needs them: how ordering works in three lines, the menu, and the order, written for them as a message.
It composes:
| Piece | Used for |
|---|---|
<sg-menu orderable> | the menu: sections of dishes with prices in rupees, units, tags in words, sold-out and ask-first dishes said as words, a quantity stepper on each dish you can order, and one polite running total |
<sg-wa-order> | the order: day (with notice), time of day, delivery or pickup, area, name, dietary needs and notes; the exact message under "This is what we'll send"; and a Send link whose address is that message |
<sg-field> | the ruled text fields inside the composer |
Nothing on the page needs wiring. The composer finds the menu by for="menu" and listens for its sg-change.
Files
| File | What it is |
|---|---|
index.html | The page, and the demo. Reads ?register, ?theme and ?palette. The studio, the dishes and the number are made up. |
recipe.js | Imports both elements and says when the page is ready. Nothing else; it wires nothing. |
recipe.css | The page around the parts: the heading, the three steps, the two columns. |
recipe.test.js | The page's own consistency: the composer's number and the fallback link's number are the same number, and the fallback message names the business. |
recipe.check.mjs | Browser checks: the whole journey on a phone (tap, tap, fill, read, send) ending on a link that decodes to the preview, the page with no JavaScript, the steps in reading order, and axe on both ends of the journey. |
What it asks of the shop
Change four things on index.html:
- The dishes in
<sg-menu>: edit the list, or write it withmenuHTML()frommenu.core.jsfrom your own data. - The composer's
number(however you write it),business,min-notice(hours) andareas. - The fallback link inside
<sg-wa-order>. Build its address withwaLink(number, text)fromwa-order.core.js, so it cannot drift fromnumber; the test inrecipe.test.jsshows how to check it. - The three steps, if your shop works differently (no pickup, a different notice).
Without JavaScript
The menu is a list, readable with or without the stylesheet: names, prices, units, tags and "Sold out" as words. The composer is the one plain link, styled as the page's strong button, with a short message: "Hello Sample Pasta Studio! I would like to order. What is available?" It opens WhatsApp. Nothing on the page is a button that would do nothing.
Honesty
The page never says an order is placed. It says "Nothing is final until we reply and confirm", and after the tap, "Your order is written; send it in WhatsApp and we'll confirm." It cannot know whether the person pressed send, and it does not take payment, hold stock or check what is available that day.