Calendar

A month grid with today marked and the chosen day lit.

Component

Calendar belongs to the Pickers group in the CyberSpec catalog. It uses @ui-sdk/react/calendar.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/calendar.json

Example

"use client"

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

// An ISO date some days from today, so the example always opens on a month
// that shows today and a chosen day.
function fromToday(days: number) {
  const date = new Date()
  date.setDate(date.getDate() + days)
  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`
}

export default function CalendarDemo() {
  return (
    <>
      <Calendar
        defaultValue={fromToday(3)}
        defaultMonth={fromToday(0).slice(0, 7)}
        unavailable={[{ weekday: [0] }, fromToday(5)]}
        code="LOWTIDE // WINDOW"
      />
    </>
  )
}

Install this example

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/calendar-demo.json

Resources

View as Markdown