Skip to main content
Owners can pick a theme for your app’s public page. The SDK provides the data half: which theme applies, where its bundle lives, and the controls to change it. The rendering half is <ThemeHost> in @cskn/ui, which runs the theme in a sandbox and draws the page tree it returns.

useThemeSelection(username, options?)

Reads are public; a visitor needs no session. When the host already resolved the theme before the page loaded, the hook starts with that answer and nothing is fetched.
ThemeSelection | null
{ theme, settings, context? }. null when no theme is chosen, or the chosen theme was withdrawn.
string | null
Version-pinned bundle path for ThemeHost. Do not build it yourself: the sandbox checks the bytes against the selection’s hash, and an unpinned URL fails that check as soon as the theme is updated.
boolean
The selection is still loading.
boolean
Whether a theme is expected to paint. Before the real answer arrives, it remembers what this browser saw last time.
object | null
The page tree the edge already produced for this exact theme version. Pass it to ThemeHost to skip the sandbox on first paint.
Promise
Change the signed-in owner’s choice. Clearing keeps their tuning in case they return.
(result) => void
Pass to ThemeHost’s onThemeResult to record render outcomes and timing.
options.appSlug defaults to the current app.

Appearance screen

useThemeGallery() lists the themes published for your app: { themes, isLoading }, each with slug, name, description, image?, version and the token paths the owner may tune. Pair it with selectTheme and @cskn/ui’s ThemeSettings for the tuning controls.

Plain functions

getThemes, getThemeSelection, saveThemeSelection, clearThemeSelection, themeBundleUrl, reportThemeResult.