Skip to main content
Wrap your app once, inside the SDK’s QueryClientProvider.
UIProvider:
  • merges your theme overrides with the defaults and publishes them as --cskn-* CSS variables, scoped to its own wrapper;
  • injects the component stylesheet and an optional reset;
  • exposes the host kind, OS and live safe-area insets through useUI();
  • hosts the toast outlet (useToast) and the confirm dialog (useConfirm);
  • starts remote-control navigation when running on a TV;
  • catches crashes below it, so a render error never leaves a blank page.

Props

DeepPartial<Theme>
Token overrides. Only the fields you set change. See Theming.
'light' | 'dark' | 'system'
default:"'system'"
Force a color mode. system follows the OS preference.
'web' | 'mobile' | 'desktop' | 'tv'
Force the host kind instead of detecting it, for example env="tv" to try TV navigation in a desktop browser.
boolean
default:"true"
Inject a normalize layer: heading and paragraph margins removed, font: inherit on form controls, block-level images and SVGs, button and link resets. Every rule has zero specificity (:where()), so your styles and the components always win. Pass false if your app relies on browser defaults.
boolean
default:"false"
In the mobile shell, give system surfaces the platform look: ActionSheet as an iOS action sheet or a Material bottom sheet, confirm() as an iOS alert or a Material 3 dialog. Web and desktop keep the kit’s neutral look either way.
'classic' | 'modern'
default:"'classic'"
The design generation of native-looking surfaces (StackNavigator, ActionSheet, confirm(), ContextMenu). classic is iOS 17–18 and Material 3; modern is iOS 26 Liquid Glass and Material 3 Expressive. A component’s own look overrides it.
boolean
default:"true in the desktop shell, false elsewhere"
Use the OS’s own dialogs and menus instead of drawing them.
  • Mobile shell (opt in): ActionSheet becomes the iOS system action sheet (Android keeps the drawn sheet), confirm() / alert() the system alert, and ContextMenu the Material menu on Android.
  • Desktop shell (on by default): ContextMenu and menu buttons become the macOS or Windows menu, with separators and shortcut hints. ActionSheet becomes a menu dropped from the control that opened it, without its title and message. confirm() / alert() become the system alert, which is a sheet on macOS. Pass false to keep the drawn versions.
Falls back to the drawn version in older shells, or when the content is more than plain text.
boolean | { min?: number; max?: number }
default:"false"
Follow the system text size (iOS Dynamic Type, Android font size) in the mobile shell. The stack, grouped lists, menus, action sheets, alerts and toasts scale their text, and --cskn-font-scale (also useUI().fontScale) is available for your own styles. true clamps the scale to 0.85–1.6; pass { min, max } to choose.
boolean
default:"false"
In the desktop shell on macOS and Windows, use the accent color the user picked in system settings as primary, the way native desktop apps do. Where there is none, your theme’s primary stays. Without this option the desktop shell still uses the accent for selected rows and focus rings, and your primary keeps buttons and switches. See useSystemAccent.
boolean | AppErrorBoundaryProps
default:"true at the root"
The root crash boundary. On for the outermost provider and off for nested ones. Pass labels, fallback or onError to customize it, or false if you mount your own at the root. See Error handling.
string
Write the page’s language to <html lang>, so screen readers, spell checking and the browser’s translate offer get it right. Pass a code such as 'tr', or 'shell' to follow the shell’s language (the browser’s on the web) as it changes. Left out, <html lang> is not touched, so an app whose i18n library already writes it keeps doing so.
boolean | WebSplashOptions
default:"false"
The launch splash in a browser. Shells draw their own splash, so this one never shows inside them. The root provider always lifts a splash that index.html put up (see Web splash). Pass true, or { title, icon, background, color }, to also put one up from React when index.html didn’t. React only shows it while the app holds the splash with preventSplashAutoHide(). Colors default to the theme’s bg and text.
Providers can be nested; an inner provider’s tokens apply only inside it.

Web splash

In the mobile, desktop and TV shells, the shell covers your app with a splash while it loads (see Launch splash). In a browser nothing does by default. Add the csknSplash() Vite plugin to show your app’s icon and name from the first paint, before your JavaScript bundle has loaded:
vite.config.ts
By default the plugin takes the name from <title> and the icon from <link rel="icon">. Pass title, icon (an image URL or an emoji), background and color to override them. A color can be one value, or { light, dark }. The root UIProvider lifts the splash by the same rule as the shells. It lifts on the first render, or on hideSplash() if you called preventSplashAutoHide(), 8 seconds at most. The plugin’s splash doesn’t show inside a shell or a frame. It also doesn’t show on a server-rendered page, whose content is already there. If your app never mounts a UIProvider, the splash removes itself after 15 seconds.

useUI

'web' | 'mobile' | 'desktop' | 'tv'
Host kind. A TV browser with no shell (webOS or Tizen loaded directly) is reported as tv too.
string | null
The operating system; null until the platform check resolves.
boolean
Running on a TV. Layouts usually go bigger and every control must be focusable.
{ top, right, bottom, left }
Live safe-area insets from the shell, in CSS px. See Safe area.
'light' | 'dark'
The color mode in use: the forced one, or the OS preference.
number
The text size multiplier in effect. 1 unless dynamicType is on.
boolean, 'classic' | 'modern', boolean
The resolved values of the props above, inherited by nested providers unless they set their own.
Theme
The resolved theme (defaults merged with your overrides). useTheme() returns just this.
useUI throws outside a UIProvider. The provider’s wrapper also carries data-cskn-env="<env>", so you can target a surface from CSS: