Staaarter

Price Calendar

A price-aware monthly calendar: each day cell shows a small price beneath the day number, the cheapest few days in the visible month get a "Best" badge and highlight styling, and the priciest days render in a subdued tone. Clicking a day selects it as the single chosen date, and a summary banner below reports its price alongside a Best deal / Good price / Higher than usual callout computed against the month's average.

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 button, badge dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/price-calendar.json

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

Usage

The file also exports booking11Demo, 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 { Booking11, booking11Demo } from "@/components/blocks/booking/booking11";

export default function Page() {
  return <Booking11 {...booking11Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Find your dates"Section heading above the calendar.
descriptionstringnoneShort subheading under the heading.
initialYearnumber2026Year the calendar opens on.
initialMonthnumber5Month the calendar opens on, 0-11.
pricesDayPrice[]nonePrice per day-of-month for the initial month; days without an entry render with no price.
currencySymbolstring"$"Symbol prefixed to every displayed price.
classNamestringnoneExtra classes for the outer section element.

Types

interface DayPrice {
  day: number;
  price: number;
}

Behavior notes

  • currentMonth (year + month) and selectedDay are real useState; prev/next navigation and day selection both work.
  • Best-price and highest-price day sets, the month average, and the selected day's callout label are all derived from the prices prop with useMemo, not hardcoded or random.
  • This block keeps single-date selection only (no range picking) by design, per the brief; navigating to a month with no matching price entries simply renders those days without a price.