Skip to contents

Localization Provider

Provides translations for Base UI components.

Déplacez-moi

Utilisez Espace et les touches fléchées.

Anatomy

Import the provider and a locale pack, then wrap the part of your application that should use it:

Anatomy

Without a provider, Base UI uses the English translations exported from @base-ui/react/locale-enUS.

The provider currently translates the accessibility text owned by the drag-and-drop components: the draggable role description, keyboard instructions, handle labels, and live-region announcements. Visible content and consumer-provided labels remain under your control.

Custom translations

Pass a partial translation object to override only the strings you need. It is usually best to start from a locale pack so the intent stays clear when new translations are added:

Custom translations

Nesting providers

Providers can be nested. An inner provider inherits the outer translations and replaces only the keys it defines:

Nested providers

useTranslations is an internal hook for Base UI components and is not part of the public package API.

API reference

translationsPartial<LocalizationProvider.Translations>enUS
Description

Translations for Base UI-owned labels, instructions, and announcements. Partial objects are merged with the inherited translations.

Type
Default
enUS
childrenReact.ReactNode
Type

LocalizationProvider.PropsHide

Re-Export of LocalizationProvider props as LocalizationProviderProps

LocalizationProvider.StateHide

LocalizationProvider.TranslationsHide