Skip to main content

Advanced Translations

Most apps don’t need to manually translate DayPicker. Locales from react-day-picker/locale already include translated month names, weekdays, and ARIA labels.

Use this guide only when you need advanced customization, such as custom wording, accessibility copy, or locale-specific formatting tweaks.

Translation props

Override ARIA labels

Use the labels prop to override any DayPicker label. Pass only the labels you want to change.

import { DayPicker, defaultLocale } from "react-day-picker";
import { fr } from "react-day-picker/locale";

export function CustomLabels() {
return (
<DayPicker
locale={fr}
labels={{
// Shorten the next/previous button copy
labelNext: () => "Mois suivant",
labelPrevious: () => "Mois précédent",
// Keep the default logic for other labels
labelDayButton: defaultLocale.labels?.labelDayButton,
}}
/>
);
}

Translatable labels

Tweak locale data

If you need to adjust date names or formatting, extend defaultLocale (or any DayPicker locale) rather than rebuilding everything.

import { DayPicker, defaultLocale } from "react-day-picker";

const locale = {
...defaultLocale,
localize: {
...defaultLocale.localize,
// Example: shorten weekday names
day: (n, opts) =>
defaultLocale.localize.day(n, { ...opts, width: "abbreviated" }),
},
};

<DayPicker locale={locale} />;

Keep overrides minimal so you inherit built-in behaviors like translated labels and month/year formatting.

Custom formatters

Use the formatters prop to customize how dates, week numbers, and weekday names are rendered.

import { format } from "date-fns";

<DayPicker
formatters={{
formatCaption: (date, options) => format(date, "LLLL yyyy", options),
}}
/>;