Room picker compare — Booking block
Probooking-room-picker-compare · for product, booking, landing pages
Room picker compare
Rooms side by side in a table, amenities ticked row by row: a hotel whose rooms differ by surface and comfort
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/booking-room-picker-compareUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import BookingRoomPickerCompare from '@/components/trame/blocks/booking/booking-room-picker-compare.vue'
const props = {
title: "Choose your room",
stay: {
checkIn: "Fri, Oct 16",
checkOut: "Mon, Oct 19",
nights: 3,
guests: "2 adults"
},
rooms: [
{
id: "classique",
name: "Classic room",
description: "Quiet, facing the courtyard, with a very comfortable double bed and a small desk.",
image: "https://images.unsplash.com/photo-1549638441-b787d2e11f14?w=1600&q=80",
alt: "A white bed by a window, light curtains and a desk lamp",
size: "194 sq ft",
beds: "1 full bed",
sleeps: "2 adults",
view: "Courtyard view",
amenities: [
"Air conditioning",
"Wi-Fi"
],
rates: [
{
id: "avance",
name: "Saver rate",
perks: [
"Wi-Fi"
],
cancellation: "Nonrefundable, paid at booking",
perNight: 11200,
total: 33600
},
{
id: "flex",
name: "Flexible rate",
perks: [
"Free cancellation",
"Wi-Fi"
],
cancellation: "Free cancellation up to 48 hours before arrival",
perNight: 12800,
total: 38400
}
]
},
{
id: "superieure",
name: "Superior room",
description: "Larger and bright, with a proper headboard and a reading armchair.",
image: "https://images.unsplash.com/photo-1630660664869-c9d3cc676880?w=1600&q=80",
alt: "A large bed with white pillows and a dark wood headboard",
size: "280 sq ft",
beds: "1 queen bed",
sleeps: "2 adults",
view: "Quiet street view",
amenities: [
"Air conditioning",
"Wi-Fi"
],
rates: [
{
id: "flex",
name: "Flexible rate",
perks: [
"Free cancellation",
"Wi-Fi"
],
cancellation: "Free cancellation up to 48 hours before arrival",
perNight: 16400,
total: 49200
},
{
id: "petit-dej",
name: "Breakfast included",
perks: [
"Buffet breakfast",
"Wi-Fi"
],
cancellation: "Free cancellation up to 7 days before arrival",
perNight: 18200,
total: 54600
}
]
}
],
action: "book-room",
changeAction: "search",
actionLabel: "Choose this rate",
options: {
eyebrow: "October 16–19",
taxNote: "Prices per room, taxes included. Plus a $2.50 occupancy tax per person per night, payable at the hotel."
}
}
</script>
<template>
<BookingRoomPickerCompare v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe heading ("Choose your room") |
| stay* | Stay | the stay the visitor searched for: the hotel’s own search, never computed here |
| rooms* | Room[] | Datathe room types the hotel offers for those dates, with the rates and prices it quotes |
| action* | string | Actionthe page action that receives the choice (posted as a form: room, rate) |
| changeAction | string | Actionthe action that reopens the search ("Change my dates") |
| actionLabel | string | Wordswhat the choose button says ("Choose this offer") |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Stay stay · 4 props
| Prop | Type | Description |
|---|---|---|
| checkIn* | string | Wordsthe arrival, as written ("Fri. 16 Oct.") |
| checkOut* | string | Wordsthe departure, as written ("Mon. 19 Oct.") |
| nights* | number | how many nights the stay lasts |
| guests* | string | Wordsthe guests, as written ("2 adults") |
Room rooms[] · 12 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Designthe key of the record |
| name* | string | Wordsthe room’s name ("Superior double room") |
| description | string | Wordsone or two lines about the room |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the picture shows |
| size | string | Wordsits surface, as written ("28 m²") |
| beds | string | Wordsits beds, as written ("1 double bed (160 cm)") |
| sleeps | string | Wordswho it sleeps, as written ("2 adults") |
| view | string | Wordswhat it looks onto ("Courtyard view") |
| amenities | string[] | Wordsan amenity of the room ("Air conditioning", "Office") |
| rates* | Rate[] | the room’s rates, up to four |
| unavailable | boolean | no room of this type for the dates: it stays shown, without rates |
Rate rooms[].rates[] · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Designposted as the chosen rate |
| name* | string | Wordsthe rate’s name ("Flexible", "Breakfast included") |
| perks | string[] | Wordswhat the rate includes ("Buffet breakfast", "Late check-out") |
| cancellation | string | Wordsthe cancellation terms, as the hotel writes them ("Free cancellation until 12 October") |
| perNight* | number | the price of one night, in cents |
| total | number | the price of the whole stay in cents, as the hotel quotes it; absent: the block multiplies by the nights |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa small line above the heading |
| taxNote | string | Wordswhat the hotel says about taxes and fees ("Tourist tax extra: €2.50 per person per night") |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
action,changeAction - Reads
roomsfrom your app
A booking section, for product, booking, landing pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More booking blocks
- Curriculum columns: a short programme seen at a glance: every module as a card with its lessons visible.
- Curriculum path: a course that is a progression: modules numbered along a path, from the first step to the last.
- Demo split: a B2B landing page’s "book a demo" section: why the call is worth it and who leads it on one side, the booking card (day, time, details) on the other.
- Demo stacked: a dedicated demo page or the closing section of a long landing page: a centred promise, the points in one ruled row, then a wide booking panel with the days down its side.
- Seat plan: a venue drawn as a simple plan: zones to pick, then their tiers: a hall where where you sit matters.
- Table inline: the whole booking on one panel inside the page: when on one side, who on the other, for a restaurant whose visitors know what they want.
- Table steps: a short wizard, when then who, with a recap of the choice: for a phone, where one thing at a time is easier.
- Trip departures cards: a rail of one card per departure with its dates large: a handful of departures, each one told with its note and guide.