@weekwise/react
import Calendar, { DateLocalizationProvider, useDateUtils, useMessages } from "@weekwise/react";import "@weekwise/react/styles.css";| Prop | Type | Description |
|---|---|---|
view |
"day" | "week" | "month" |
Controlled current view. |
defaultView |
"day" | "week" | "month" |
Initial view (defaults to "week"). |
viewValue |
Date |
Controlled visible date. |
defaultViewValue |
Date |
Initial visible date (defaults to today). |
startWeek |
0 | 1 | ... | 6 |
First day of the week (defaults to the adapter’s locale). |
timeStep |
number |
Minutes per timeline step (defaults to 15). |
timeFrame |
{ hourMin?: number; hourMax?: number } |
Visible hour range. When set, changes are constrained to the range. |
hideMinMaxTime |
boolean |
Hides time outside the timeFrame. |
items |
TValue[] |
Event data. |
eventTimeFrameResolver |
(item) => { start: Date; end: Date } |
Resolves an item to its time span. |
eventKeyResolver |
(item) => string | number |
Resolves an item to a unique key. |
disabled |
boolean |
Disables interactions. |
scrollable |
boolean |
Makes the timeline scrollable. |
getIsDayDisabled |
(date: Date) => boolean |
Disables a day for event creation/drop. |
onEventChange |
(item, start, end) => void |
Called when an event is moved or resized. |
onEventCreate |
(start, end) => void |
Called when a new event is created on the timeline. |
onEventDelete |
(item) => void |
Called when an event is deleted. |
onEventEdit |
(item) => void |
Called when an event is edited. |
onChangeView |
(view) => void |
Called when the view changes. |
onChangeViewValue |
(viewValue, currentView) => void |
Called when the visible date changes. |
pointerPreviewFormat |
(from, to) => ReactNode |
Customizes the drag/resize preview label. |
children |
(item, view, part) => ReactNode |
Renders an event item. part ({ isStart, isEnd }) says whether the card continues from / into another day, to flatten its edges there. |
Any other props are spread onto the root div.
Next.js
Section titled “Next.js”Works with the App Router (tested with Next.js 16 and React 19, including static
prerendering). The package ships with a "use client" directive.
Render the calendar from a Client Component: its children is a render
function and the adapter is a class, and neither can be passed from a Server
Component.
"use client";
import Calendar, { DateLocalizationProvider } from "@weekwise/react";import { DateFnsAdapter } from "@weekwise/adapter-date-fns";
export default function Schedule() { return ( <DateLocalizationProvider adapter={DateFnsAdapter}> <Calendar>{(event) => <div>{event.title}</div>}</Calendar> </DateLocalizationProvider> );}// app/schedule/page.tsx (a Server Component)import Schedule from "./Schedule";import "@weekwise/react/styles.css";
export default function Page() { return <Schedule />;}The calendar renders on the server and hydrates without mismatches: browser-only parts (drag and drop, popovers, the “now” line) appear after hydration.
Note that a statically prerendered page is rendered at build time, when “today”
may be a different day than when it is viewed. If you show the current week
without a fixed viewValue, render the page dynamically
(export const dynamic = "force-dynamic") so the server and the browser agree
on the date.
Custom date library
Section titled “Custom date library”Any object implementing the DateAdapter interface from @weekwise/core works as
an adapter. Adapters for date-fns, Day.js, Luxon and Temporal are ready; see
@weekwise/core to write your own.
The calendar’s date type follows the adapter: with @weekwise/adapter-temporal, viewValue,
eventTimeFrameResolver, onEventChange and the other date props are
Temporal.ZonedDateTimes. TypeScript infers it from the props; give it explicitly when it
cannot: <Calendar<Meeting, Temporal.ZonedDateTime> …>. Read the adapter in your own
components with useDateUtils<Temporal.ZonedDateTime>().