MonthCalendar

My leave and holidays over one month.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/month-calendar.json

Month with marks

7 cell kinds, one size. Leave uses the status colours, like the badges: approved = green (success), waiting for HR = amber (warning) with a dashed edge. The module colour is never a status. When two apply, the first wins: today → approved → pending → holiday → weekend → default. Always 6 week rows and the same 5 legend rows (marks not in this month are dimmed), so the card has one height in every month. Use the arrows to change month. Motion: transitions.dev 08 Page side-by-side: the grid and legend of the new month enter 8 px from the click side (› right, ‹ left) with a fade and a 3 px blur, 250 ms; the weekday row stays still; fast clicks retarget (latest month wins). Title: 04 Text swap, 150 ms, read once by screen readers. Card height: fixed, no resize. Late leave data: cell fills and the legend row fade in 150 ms. Reduced motion: the month changes at once.

Desember 2026

Cuti saya dan hari libur

12345678910111213141516171819202122232425262728293031
  • Cuti saya, disetujui
  • Menunggu HR
  • Hari libur: Natal 25 Des
  • Akhir pekan
  • Hari ini, Kamis 17 Des

When to use

  • The side card on Cuti saya (employee): one person, one month.
  • Showing which days are already off (weekend, holiday) before the user asks for leave.

When not to use

  • Many people in one month (admin Cuti · Kalender) → the team calendar with chips per person.
  • Picking dates in a form → DateField (its own popup calendar).
  • A short list of upcoming dates → Card + date ListRows.

Do and don't

DoShow the days that are already freeGrey weekends and the holiday bar on 25 Des let the user see that 30–31 Des next to a weekend and Tahun Baru gives a long break.
Don'tModule colour as a status, red holiday cellsA Cuti-teal cell says "this is Cuti", not "approved": status cells use green / amber, as the badges do. A red fill reads as an error: holidays are grey like weekends with one small red bar. Weeks start on Senin.

Installation

Add MonthCalendar with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/month-calendar.json

API

import { MonthCalendar } from "@/components/mahr/month-calendar"
PropTypeDefaultDescription
month · onMonthChangeDate | string · (month: Date) => voidthis monthControlled by the page; it fetches leave for that month.
leave{ from, to, status: "approved" | "pending" }[][]Rejected and cancelled requests are not passed.
holidays{ date, name }[][]Names go in the legend row ("Natal 25 Des").
todayDate | stringnew Date()Week starts Senin (fixed, not a prop). No module prop: leave cells use the status colours.
title · notestring · string–Defaults: "Desember 2026" · "Cuti saya dan hari libur".
error · onRetryboolean · () => voidfalseFailed load: the grid keeps its space (invisible), "Gagal dimuat." + secondary "Coba lagi" sit on it. Same height.