When to use
Section titled “When to use”Use Provider to give the language, text direction and motion preference of an app, or part of it, in one place. In most apps, a single Provider wraps the app root.
When not to use
Section titled “When not to use”- To pick a theme or brand: Theme and brand are not Provider props; set
data-themeanddata-brandattributes on the app root. - For app copy: Provider translates only the library’s own strings (
ui.*); screen titles and labels are the app’s job. - Around every component: Do not repeat the same setting; a single Provider is enough unless one area differs.
Anatomy
Section titled “Anatomy”import { Button, Provider } from '@bigbang/ui';
export default function Locale() { return ( <Provider locale="en-GB"> <Button loading>Primary button</Button> </Provider> );}- Wrapper: One
<div>withdisplay: contents; thelang,diranddata-motionattributes sit on it. It creates no box and does not change layout. - Content:
children; the settings apply to this area and everything below it.
Behaviour
Section titled “Behaviour”- The
localedefault istr-TR,directionisltr,reducedMotionissystem. The library also works in Turkish without a Provider. locale:tr-TRoren-GB. It sets the library strings (loading, done, required, optional) and thelangof the wrapper.direction: setsdiron the wrapper and feeds Base UI’sDirectionProvider; arrow keys and popups follow the direction.reducedMotion="reduce": setsdata-motion="reduce"on the wrapper. The token CSS switches to reduced values anduseReducedMotion()returnstrue.reducedMotion="system"leaves motion to the operating system. Neither can turn motion back on: a nested Provider does not undo an outerreduce.- Language and direction come from the nearest Provider; a nested Provider changes them only for its own area.
Guidelines
Section titled “Guidelines”Use a single Provider
Section titled “Use a single Provider”Set it once at the app root. If one area differs, wrap only that area.
Match the app language to the library language
Section titled “Match the app language to the library language”locale changes the library strings, not the app strings. Provide the app’s own copy in the same language.
Content
Section titled “Content”localeis a language tag:tr-TR,en-GB. Another language needs a string catalogue added to the library.- Library strings stay short: “Loading”, “Done”, “required”, “optional”.
- To change the text of one component, use its own prop (such as
loadingLabel); Provider changes the whole area.
| String | tr-TR | en-GB |
|---|---|---|
ui.button.loading |
Yükleniyor | Loading |
ui.button.success |
Tamamlandı | Done |
ui.field.required |
zorunlu | required |
ui.field.optional |
isteğe bağlı | optional |
Material
Section titled “Material”material="glass" turns the chrome inside into glass: the top bar, popups, menus, toasts, toolbars and segmented controls. Tables, forms, cards, charts, money fields, tooltips and the page background stay solid. The default is solid. A Provider without the prop keeps the material of the one around it, and a nested material="solid" keeps its part of the page solid. When the system asks for reduced transparency the Provider renders solid. See Material.