App page vs. user page
The app page is the tool; the user page is the creator’s public output from that tool (their blog, their gallery, their CV). Most apps render something quite different on each:
Shell vs. browser
A native shell (the cskn mobile, desktop or TV app) attaches a message bridge atwindow.cskn.bridge. A plain browser has none.
getPlatform() / usePlatform() return the host kind and the operating system:
UIProvider, useUI() gives you the same information synchronously, plus isTV and the live safe-area insets. See UIProvider.
Choosing where your app is listed
Theplatforms field of your app’s cskn.json lists the shells that offer your app. Each deploy publishes it.
cskn.json
The list must be non-empty and use only these four values. An app without
tv never appears on a TV, so add it only once your app works with a remote. If you leave platforms out, the deploy keeps the list your app had before; a new app is then listed everywhere.
One UI per surface
A phone screen, a desktop window and a TV across the room want different layouts.appSurfaces lets your app ship a separate root component for each surface. Each one is a lazily loaded chunk, so the TV UI never downloads on a phone.
src/app/index.tsx
React.lazy.
The desktop shell. Falls back to
mobile when you leave it out.The TV shell. Falls back to
mobile when you leave it out. The TV shell only opens apps that list tv in platforms.web surface renders at once. In a shell nothing renders until the shell has said what it is, so the wrong surface is never mounted first.
useSurface() returns the surface appSurfaces picked: 'web', 'mobile', 'desktop' or 'tv'. In a browser it has the answer immediately; in a shell it returns null until the bridge answers.
What changes per surface
Authentication
Authentication
In a shell the user’s token arrives over the bridge. In a browser the user is signed in with a cookie on the app’s own domain.
useBridgeAuth handles both. See Authentication.Native features
Native features
Some bridge calls have a browser fallback (photo capture falls back to a file picker, notification permission falls back to Web Push), some resolve to
not_available, and a few never resolve without a shell. Check the availability table before calling one from code that also runs in a browser.Header and system chrome
Header and system chrome
Mobile and desktop shells draw a native header above your page. In a browser and on TV there is none, so you draw your own.
NativeHeader from @cskn/ui picks the right one for you.Input
Input
TV has no touch and no pointer, only a remote. @cskn/ui runs a spatial navigator there so arrow keys move focus between controls. See TV navigation.