# Calendar with pricing

> Calendar with pricing

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-calendar-17).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-calendar-17
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-calendar-17-light-e61860bb6aea2794.png
- Registry item: https://reui.io/r/new-york-v4/c-calendar-17.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-calendar-17.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `calendar`

## Files

### `c-calendar-17.tsx`

```tsx
"use client"

import { useState } from "react"

import { Calendar, CalendarDayButton } from "@/components/ui/calendar"

function getPriceForDate(date: Date) {
  const seed =
    date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()

  const val = (seed * 9301 + 49297) % 233280

  return Math.floor(50 + (val / 233280) * 200)
}

export function Pattern() {
  const [date, setDate] = useState<Date | undefined>(new Date())

  return (
    <Calendar
      mode="single"
      selected={date}
      onSelect={setDate}
      showOutsideDays={false}
      className="rounded-lg border [--cell-size:--spacing(12)]"
      components={{
        DayButton: ({ children, modifiers, day, ...props }) => {
          const price = getPriceForDate(day.date)
          const isGreen = price < 100

          return (
            <CalendarDayButton day={day} modifiers={modifiers} {...props}>
              {children}
              {!modifiers.outside && (
                <span
                  className={
                    isGreen ? "text-green-600 dark:text-green-400" : ""
                  }
                >
                  ${price}
                </span>
              )}
            </CalendarDayButton>
          )
        },
      }}
    />
  )
}
```
