Skip to content

Instantly share code, notes, and snippets.

@diegohaz
Last active June 13, 2024 14:53
Show Gist options
  • Save diegohaz/deb541a7009112526c00bb35f612f691 to your computer and use it in GitHub Desktop.
Save diegohaz/deb541a7009112526c00bb35f612f691 to your computer and use it in GitHub Desktop.
import {
Calendar,
CalendarRow,
CalendarCell,
CalendarWeeks,
CalendarWeekDays,
} from "@ariakit/react";
function MyCalendar() {
return (
<Calendar defaultDate={new Date("2019-03-02")} firstWeekDay={1}>
<thead>
<tr>
<CalendarWeekDays>
{(days) => days.map((day) => (
<th key={day}>{day.slice(0, 3)}</th>
))}
</CalendarWeekDays>
</tr>
</thead>
<tbody>
<CalendarWeeks>
{(weeks) => weeks.map((dates, i) => (
<CalendarRow key={i}>
{dates.map((date) => (
<CalendarCell key={date} date={date} />
))}
</CalendarRow>
))}
</CalendarWeeks>
</tbody>
</Calendar>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment