Skip to main content

Week Numbers and Footer

Week Numbers

To display the column with week numbers, use the showWeekNumber prop.

<DayPicker showWeekNumber />

Handling Week Numbers Click

To handle clicks on the week numbers, you can set the WeekNumber custom component:

<DayPicker
showWeekNumber
components={{
WeekNumber: (props) => (
<button onClick={() => alert(`Week ${props.weekNumber}`)}>
{props.weekNumber}
</button>
),
}}
/>

Selecting the Whole Week

In selection mode, you can create a custom selection that selects the entire week when a day is clicked.

Use the footer prop to display a footer below the calendar. The footer acts as a live region to announce changes to screen readers. For more information on making the calendar accessible, see the Accessibility guide.

export function Footer() {
const [selected, setSelected] = React.useState<Date>();
return (
<DayPicker
mode="single"
selected={selected}
onSelect={setSelected}
footer={
selected
? `You picked ${selected.toLocaleDateString()}.`
: "Please pick a date."
}
/>
);
}

Custom Components

In DayPicker, you can replace the components used internally to render the calendar. For more information, see the Custom Components guide.