Room picker cards — Booking block

Pro

booking-room-picker-cards · for product, booking, landing pages

Room picker cards

Rooms as photo cards, the rate picked inside the card: a small hotel with three or four rooms that sell by the picture

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-cards

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import BookingRoomPickerCards from '@/components/trame/blocks/booking/booking-room-picker-cards.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>
<BookingRoomPickerCards v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordsthe heading ("Choose your room")
stay*Staythe 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*stringActionthe page action that receives the choice (posted as a form: room, rate)
changeActionstringActionthe action that reopens the search ("Change my dates")
actionLabelstringWordswhat the choose button says ("Choose this offer")
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Stay stay · 4 props
PropTypeDescription
checkIn*stringWordsthe arrival, as written ("Fri. 16 Oct.")
checkOut*stringWordsthe departure, as written ("Mon. 19 Oct.")
nights*numberhow many nights the stay lasts
guests*stringWordsthe guests, as written ("2 adults")
Room rooms[] · 12 props
PropTypeDescription
id*stringDesignthe key of the record
name*stringWordsthe room’s name ("Superior double room")
descriptionstringWordsone or two lines about the room
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows
sizestringWordsits surface, as written ("28 m²")
bedsstringWordsits beds, as written ("1 double bed (160 cm)")
sleepsstringWordswho it sleeps, as written ("2 adults")
viewstringWordswhat it looks onto ("Courtyard view")
amenitiesstring[]Wordsan amenity of the room ("Air conditioning", "Office")
rates*Rate[]the room’s rates, up to four
unavailablebooleanno room of this type for the dates: it stays shown, without rates
Rate rooms[].rates[] · 6 props
PropTypeDescription
id*stringDesignposted as the chosen rate
name*stringWordsthe rate’s name ("Flexible", "Breakfast included")
perksstring[]Wordswhat the rate includes ("Buffet breakfast", "Late check-out")
cancellationstringWordsthe cancellation terms, as the hotel writes them ("Free cancellation until 12 October")
perNight*numberthe price of one night, in cents
totalnumberthe price of the whole stay in cents, as the hotel quotes it; absent: the block multiplies by the nights
Options options · 3 props
PropTypeDescription
eyebrowstringWordsa small line above the heading
taxNotestringWordswhat the hotel says about taxes and fees ("Tourist tax extra: €2.50 per person per night")
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa 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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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 rooms from 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 accordion: a long programme read module by module: real disclosures, the first open, what you will learn and the teacher beside.
  • 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.

All 25 booking blocks