Staaarter

Car Rental Booking

A car rental booking widget: pickup/return location and date fields, a photo grid of selectable car classes (each with seats/transmission specs and a daily rate), an insurance tier picker built from real radio inputs styled as cards, and an add-ons checklist. The price breakdown multiplies the selected car's and insurance tier's daily rates by the number of days between the two dates and adds any checked add-ons, falling back to a prompt when the dates aren't valid yet.

By Staaarter Team
Booking
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its media-slot, button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/car-rental-booking.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/booking/booking20.tsx instead.

Usage

The file also exports booking20Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Booking20, booking20Demo } from "@/components/blocks/booking/booking20";

export default function Page() {
  return <Booking20 {...booking20Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Reserve your rental car"Section heading.
subheadingstring"Choose your dates, pick a class, and see the full price before you book."Supporting copy under the heading.
classNamestringnoneExtra classes for the outer section element.

Behavior notes

  • Pickup/return location text inputs and the two date inputs are real controlled state.
  • The car class grid (Compact/SUV/Luxury) is real single-select state: clicking a card selects it and highlights it with a ring, driving the daily rate used in the price calc.
  • The insurance tier picker is three real native `input[type=radio]` elements styled as cards, real single-select state.
  • The add-ons checklist (GPS, child seat, additional driver) is real native checkboxes backed by a Set of checked ids.
  • The price breakdown parses the two date strings with `new Date(dateString)` to compute a day count, then multiplies the selected car's and insurance tier's daily rates by that count and adds checked add-on prices; it shows a fallback message when the dates don't form a valid range.
  • The 'Reserve now' button is decorative only, no submission handler is wired since that would require a real backend.