datui
Color scheme

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(): light

dark scheme

useColorScheme(): dark

Right-to-left

مرحبا بالعالم

Accessibility

  • direction sets the dir attribute on AppRoot and configures Radix primitives, so arrow-key navigation follows the reading direction.
  • locale sets lang on AppRoot, so screen readers pick the right pronunciation.
  • useTransitionMotion() returns false when transitionMotionEnabled is 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.

PropTypeDefaultDescription
colorSchemeColorSchemePreference"system"
directionTextDirection"ltr"
localestring"en"
transitionMotionEnabledbooleantrueDisables panel and modal transitions. Reduced-motion users get this automatically.

ColorSchemeProvider

Provides the resolved color scheme to descendants. `AppRoot` applies it as `data-theme`.

PropTypeDefaultDescription
value (required)ColorSchemePreference—`system` follows the operating system preference.

LocaleProvider

PropTypeDefaultDescription
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.

PropTypeDefaultDescription
value (required)TextDirection—