Skip to Content
AxiomProvider

AxiomProvider

AxiomProvider provides all the context managers required for our components to work. It must be rendered at the root of your application and should be used only once.

#

Documentation

#

Usage

import { AxiomProvider } from "@optiaxiom/react"; export function App() { return <AxiomProvider>{/* Your app code here */}</AxiomProvider>; }

#

Locale

Use the locale prop to set a BCP-47 language tag  used to localize date and time components such as Calendar, DateRangePicker, Clock, and Time. This controls their captions, weekday headers, week start, range text, AM/PM labels, and numbering system. When omitted, the browser locale is used.

<AxiomProvider locale="fr-FR">{/* Your app code here */}</AxiomProvider>

A string leaves the text components render on their own, such as close buttons, Pagination labels and screen reader announcements, in English. To translate that text too, import a Locale and pass it instead. Each language is its own entry point, so your app only bundles the one it imports.

import { de } from "@optiaxiom/react/locale/de"; <AxiomProvider locale={de}>{/* Your app code here */}</AxiomProvider>;

Language

Import

Englishimport { en } from "@optiaxiom/react/locale/en"
Frenchimport { fr } from "@optiaxiom/react/locale/fr"
Germanimport { de } from "@optiaxiom/react/locale/de"
Japaneseimport { ja } from "@optiaxiom/react/locale/ja"
Spanishimport { es } from "@optiaxiom/react/locale/es"

A Locale is a code used for dates and messages with every built-in label keyed by its English text. Spread one to format dates for a region ({ ...de, code: "de-AT" }), or build your own for a language Axiom doesn’t ship. TypeScript checks that it has every key.

import { AxiomProvider, type Locale } from "@optiaxiom/react"; const sv: Locale = { code: "sv-SE", messages: { "Next page": "Nästa sida" /* … */ }, }; <AxiomProvider locale={sv}>{/* Your app code here */}</AxiomProvider>;

Toast

Display brief popup notifications.

Tooltip

Popup with brief information shown when user interacts with an element using keyboard focus or mouse hover.

#

Props

#

AxiomProvider

import { AxiomProvider } from "@optiaxiom/react"; // or import { AxiomProvider } from "@optiaxiom/react/axiom-provider";

Doesn't render its own HTML element.

Prop

children

ReactNode

dialog

Props for the DialogKitProvider component

Documentation

Omit<DialogKitProviderProps, "children">

locale

A BCP-47 tag (e.g. "fr-FR") localizes date/time components such as Calendar, DateRangePicker, Clock, and Time, falling back to the browser locale; built-in labels stay English. Pass a Locale instead (import { en } from "@optiaxiom/react/locale/en", or your own) to also translate built-in labels and screen reader text.

string | Locale

toast

Props for the ToastProvider component

Documentation

Omit<ToastProviderProps, "children">

tooltip

Props for the TooltipProvider component

Documentation

Omit<TooltipProviderProps, "children">

#

Changelog

#

3.6.0

  • Accept a Locale in the locale prop to translate built-in labels
  • Added German, Spanish, French and Japanese locales

#

3.1.2

  • Added the locale prop to override the locale used by date/time components

#

0.1.0

  • Added component
Last updated on