Providers & app
ConfigProvider
App-wide settings: color scheme, locale, text direction and transition motion. ColorSchemeProvider, LocaleProvider and DirectionProvider are also available on their own.
import { ConfigProvider, ColorSchemeProvider, LocaleProvider, DirectionProvider } from "datui";Examples
Scoped color scheme
Nest a provider with an embedded AppRoot to theme part of a page.
light scheme
useColorScheme(): lightdark scheme
useColorScheme(): darkRight-to-left
مرحبا بالعالم
Accessibility
directionsets thedirattribute onAppRootand configures Radix primitives, so arrow-key navigation follows the reading direction.localesetslangonAppRoot, so screen readers pick the right pronunciation.useTransitionMotion()returns false whentransitionMotionEnabledis off or the user prefers reduced motion.
API
ConfigProvider
Single entry point for app-wide datui settings. Combine with `AppRoot`, which applies them to the DOM.
| Prop | Type | Default | Description |
|---|---|---|---|
| colorScheme | ColorSchemePreference | "system" | |
| direction | TextDirection | "ltr" | |
| locale | string | "en" | |
| transitionMotionEnabled | boolean | true | Disables panel and modal transitions. Reduced-motion users get this automatically. |
ColorSchemeProvider
Provides the resolved color scheme to descendants. `AppRoot` applies it as `data-theme`.
| Prop | Type | Default | Description |
|---|---|---|---|
| value (required) | ColorSchemePreference | — | `system` follows the operating system preference. |
LocaleProvider
| Prop | Type | Default | Description |
|---|---|---|---|
| value (required) | string | — | BCP 47 language tag used for dates, numbers and built-in labels. |
DirectionProvider
Sets text direction for datui components and the Radix primitives underneath them.
| Prop | Type | Default | Description |
|---|---|---|---|
| value (required) | TextDirection | — |