Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Guest Count Ruler Contact Block for React

An event-catering request for a caterer: a guest-count slider drawn as a ruler beside the cost per head and the total, then a three-course menu, dietary needs and a short form on ruled bands.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

An event-catering request section for React with Base UI, laid out on ruled bands under a start-aligned header. The first band is a guest-count slider from 10 to 300 in stops of ten, drawn as a ruler (a tick at every ten guests, a taller one at every fifty and a number at seven of them) beside the price per head and the total for the party, which follow the count and the courses chosen. The second holds the menu, with a Select each for a starter, a main course and a dessert (each option names its price), a list of dietary needs as checkboxes that say how many guests each usually means once ticked, and a name and an email. Submitting checks every field, shows each problem under its field and moves focus to the first one; a valid request turns the second band into a confirmation while the count and the price stay where they are. A last band holds the contact details. It's built from Slider, Select, Checkbox, Field, Input, Guides and Shine Button, with your theme's tokens for every colour. For caterers, venues and anyone who prices an event by the head.

FAQ

How is the price worked out?

Each guest costs the service and staff rate plus every course chosen. The rate falls with the size of the party ($32 under 50 guests, $28 from 50, $25 from 100, $22 from 200), set in RATES, and each dish has its own price in the lists at the top of the file. The total is the price per head times the guests. All the figures are made up for the demonstration, the button's note says so, and none of them is an offer.

What do the numbers beside the dietary needs mean?

Each need has the share of a party it usually covers (20% vegetarian, 8% vegan, 10% gluten-free, 6% nut-free, 12% halal, in DIETS). Tick one and the row says "about 24 guests", the count times the share, rounded up, which follows the slider. The caterer still asks for names and exact numbers; the block only shows what to expect. The line reserves its width, so ticking a box moves nothing.

How does the slider work with a keyboard and a screen reader?

It moves ten guests at a time with the arrow keys, Home goes to 10 and End to 300. The thumb is named "Number of guests" and a screen reader hears the value as "120 guests". The ruler is decoration, hidden from assistive technology; the number in large type is the visible value. When you stop moving, or choose a course, one hidden status line reads the count, the price per head and the total.

How does the form check what's typed?

The form has noValidate, so the browser's own bubbles stay away and the block shows its own messages. On submit, problems checks a main course, a name and an email address with an @ and a domain; a starter and a dessert can be "No starter" and "No dessert". Each problem appears under its field with an icon, the control is marked invalid and described by the message, and focus moves to the first one. Leaving a filled field checks it, and editing a field that shows an error re-checks it as you type.

Where does the form send its data?

Nowhere yet. The submit handler waits 800 milliseconds as a stand-in for a request, then shows the confirmation. Replace that timer in submit with your own call: details holds the guests, the three courses, the dietary needs, the name and the email. The confirmation repeats the count, the price per head, the total, the courses and the number of dietary needs, and says a coordinator will write to the address given; it promises nothing else.

How does it fit on a phone?

The bands stack. The slider band shows the ruler (seven numbers fit across 320 pixels) with the price per head and the total side by side under it; the three selects follow, then the dietary list, the name and the email, and a full-width button. The price figures keep their size as the count grows, so nothing below them moves.

  • Pro

    Budget Range Slider Contact

    Quotes and estimates

    A roofing quote request as a card in a card: three kinds of job, a two-thumb budget slider that says in words what the range covers, and a short form that checks itself.

  • Pro

    Loan Payment Slider Contact

    Finance and property

    A personal-loan request for a lender: an amount slider with a tick at each $5,000 and a term to pick, a panel that works the monthly payment out as you move, and a form that checks itself.

  • Pro

    Premium Builder Contact

    Finance and property

    A home-cover quote for an insurer, split by a hairline: a slider over five levels of cover and three risk switches at the start, a premium built line by line and a short form at the end.

  • Pro

    A portfolio inquiry for an advisory firm: a risk slider over five named profiles that redraws a stacked bar of stocks, bonds and cash at full width, then a short inquiry form on ruled bands.

  • Pro

    Reservation FAQ

    Calculators and tools

    A FAQ for a wood-fired restaurant with a reservation widget in a card in card: a party size, six time-slot chips and a live line, "Table for 4 at 7:30 pm, 2 free", above six questions.

  • Pro

    A receipt that prices itself, for a webhook-delivery service: number steppers for seats, events and days of history drive a live bill that stamps the cheapest plan and itemises what goes past its allowance.