Origin UI

Calendar [React-Area]

Component 14

About

Calendar [React-Area]

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Calendar [React-Area] to your project and fits it to your theme.

Code

How Calendar [React-Area] is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { RangeCalendar } from "@/components/ui/calendar-rac";
import { getLocalTimeZone, isWeekend, today } from "@internationalized/date";
import { useLocale } from "react-aria";
import type { DateValue } from "react-aria-components";

function Component() {
  const now = today(getLocalTimeZone());
  const disabledRanges = [
    [now, now],
    [now.add({ days: 14 }), now.add({ days: 14 })],
    [now.add({ days: 23 }), now.add({ days: 23 })],
  ];

  const { locale } = useLocale();
  const isDateUnavailable = (date: DateValue) =>
    isWeekend(date, locale) ||
    disabledRanges.some(
      (interval) => date.compare(interval[0]) >= 0 && date.compare(interval[1]) <= 0,
    );

  return (
    <div>
      <RangeCalendar
        className="rounded-lg border border-border p-2"
        isDateUnavailable={isDateUnavailable}
        minValue={today(getLocalTimeZone())}
      />
      <p
        className="mt-4 text-center text-xs text-muted-foreground"
        role="region"
        aria-live="polite"
      >
        Disabled dates -{" "}
        <a
          className="underline hover:text-foreground"
          href="https://react-spectrum.adobe.com/react-aria/DateRangePicker.html"
          target="_blank"
          rel="noopener nofollow"
        >
          React Aria
        </a>
      </p>
    </div>
  );
}

export { Component };

Dependencies

More by Origin UI

View all
  • Dialog

    Dialog

    1.2K
  • Avatar

    Avatar

    951
  • useImageUpload

    useImageUpload

    926
  • usePagination

    usePagination

    622
  • Popover

    Popover

    384
  • Button

    Button

    364
  • Command

    Command

    321
  • Accordion

    Accordion

    258