Skip to main content
On mobile and desktop, the shell draws a native header above your page. You can change its title and colors, add an action button, hide it, or close the app.
If your app also runs in a browser, use NativeHeader from @cskn/ui. It sets the native header in a shell and draws an in-page header everywhere else.

setHeader

Only the fields you pass change; the rest keep their current value. The configuration belongs to your app and is reset when it closes.
string
Header title. Defaults to the app’s name.
string
Header background. Defaults to the shell’s theme.
string
Color of the title, the back and close chevrons, and the action icon.
{ icon: string; id?: string } | null
The button on the right. icon is an Ionicons name such as share-outline; unknown names show an ellipsis. id comes back in useHeaderAction. Pass null to remove the button.
The back button is automatic: when the WebView has history to go back to, the shell shows a back chevron on the left and navigates back on tap.

Launch splash

While your app loads, the mobile, desktop and TV shells cover it with a splash: your app’s icon and name. By default the splash lifts once the page has loaded and received its auth token. If your app still fetches data or resolves a route after that, users see a spinner or an empty screen next. Keep the splash up until your first real screen is ready instead.
main.tsx
The shell never waits forever. If hideSplash() doesn’t arrive within 8 seconds of load, the splash lifts anyway. A load error lifts it at once. AppErrorBoundary from @cskn/ui calls hideSplash() when it shows an error screen. In shells that predate these calls, they do nothing and the splash lifts on load as before. In a browser they control the web splash from @cskn/ui, if your app uses it.

Other controls

Off-shell, all of these are no-ops.

Desktop window

In the desktop shell, a mini app can run in the shell’s main window or in a window of its own. If your app hides the shell’s header and draws its own toolbar, use these to offer the window buttons the header used to carry. The @cskn/ui DesktopWindow and StackNavigator do this for you.
getWindowInfo() resolves { solo }, where solo is true when the app has a window of its own. It resolves null where there are no window controls: on phones and TVs, in a browser, and in desktop shells that predate it (after a short timeout). windowAction(action) asks the shell to act on the window: Outside the desktop shell, windowAction does nothing.

Active window

Native desktop apps grey their selection and dim their toolbar when their window is not the active one. The UI kit does this for its own components. For your own styles, follow the window with onWindowFocusChange:
isWindowFocused() returns the last known state. It is always true outside the desktop shell and in desktop shells that predate it. Inside a UIProvider you can also use CSS: the kit sets data-cskn-window="inactive" on <html> while the window is in the background. On macOS, the desktop shell can show a menu named after your app in the system menu bar, the way native apps list their commands. useAppMenu sets it while the component is mounted and removes it on unmount.
string
required
Passed to your handler when the item is clicked.
string
required
Item text.
string
A key combination such as mod+n or mod+shift+e. mod is ⌘ on a Mac and Ctrl elsewhere.
boolean
default:"true"
false greys the item out.
boolean
Shows a tick in front of the item.
Pass { separator: true } for a divider. Change the items and the menu follows; pass null to remove it. A shortcut listed in the menu belongs to the menu: the shell turns the key press into a menu click. Handle the command in the menu handler and don’t bind the same key in the page as well. In a browser, where there is no menu, bind it with useShortcut instead. Without the hook, setAppMenu(items | null) sets the menu and onAppMenuAction(cb) listens for clicks; it returns an unsubscribe. Everywhere except the macOS desktop shell, these do nothing.