TV apps
Docs TV TV · 7 min to read this section

#TV apps

#What is planned

TV systemPlan
Android TVThe Android app, with a remote-control (D-pad) focus ring and a TV layout kit
Apple tvOSA tvOS shell around the same pages
LG webOSA packaged web app for LG TVs
Samsung TizenA packaged web app for Samsung TVs

The pages will be the same .kreft files as your website, desktop and phone apps, like every other target in One codebase. Every screen. There is no release date, and nothing here is promised until it ships and is tested.

#What works on a TV today

A TV that has a web browser can open your website. That is a website, not a packaged TV app: it is not in the TV's app store, and Kreft adds nothing for the remote. If you want your site to be usable from a TV browser now, plain web practice helps:

  • Use real <button> and <a> elements for everything that can be pressed, so the TV browser can move between them.
  • Give them a clear focus style (:focus-visible), large enough to see from a sofa.
  • Use large text and wide spacing, and keep the important things away from the edges of the screen.
  • Don't hide actions behind hover: a remote has no mouse.

#Follow the progress

New platforms are announced in the changelog and on kreftjs.com. Until a TV target is listed as available there, build for the web, desktop and phones.

#One codebase. Every screen.

One codebase, every screen. A single Kreft project runs as a web application, a desktop app for macOS, Linux and Windows (with Electron or Tauri), and a phone or tablet app for iOS, Android and HarmonyOS. TV apps are coming soon and are not available yet. The pages are the same .kreft files everywhere; each target only adds a native shell around them.

#Where a Kreft app runs

TargetShellAdd itRun itPackage itStatus
Web applicationthe browserkreft new my-appkreft devkreft buildTested
macOS (Electron)Electronkreft add electronkreft electron:devkreft electron:build --macTested
Linux (Electron)Electronkreft add electronkreft electron:devkreft electron:build --linuxNot tested here
Windows (Electron)Electronkreft add electronkreft electron:devkreft electron:build --winNot tested here
macOS (Tauri)Taurikreft add taurikreft tauri:devkreft tauri:buildTested
Linux (Tauri)Taurikreft add taurikreft tauri:devkreft tauri:buildNot tested here
Windows (Tauri)Taurikreft add taurikreft tauri:devkreft tauri:buildNot tested here
iOSCapacitorkreft new my-app --mobilekreft mobile:run --ioskreft mobile:release --iosNot tested here
AndroidCapacitorkreft new my-app --mobilekreft mobile:run --androidkreft mobile:release --androidTested
HarmonyOSArkTS web viewkreft new my-app --harmonykreft harmony:open (DevEco Studio)kreft mobile:release --harmonyNot tested here
Android TV, tvOS, webOS, TizenComing soon

What the status means. Tested means Kreft's own tests ran it for real: the Electron and Tauri apps were started on macOS and checked (menu, DevTools, window, security, production builds), and an Android app was run on the emulator and built as a signed release. Not tested here means the same code is meant to run on that system, but Kreft has not run it there: build it on that system and check it before you ship. Coming soon means planned and not available.

#Which one do I choose?

I want…Choose
A website onlyThe web. Nothing to add.
A desktop app, and I want the page to look the same on every systemElectron. It ships its own Chromium. Needs only Node.js. Installers are about 100 MB.
A desktop app with a small installer, and I can use RustTauri. It uses the system's web view. Installers are a few megabytes. Needs Rust.
An app in Google PlayAndroid.
An app in the App StoreiOS. Needs a Mac with Xcode and a paid Apple Developer account.
An app for Huawei phones and tabletsHarmonyOS. Needs DevEco Studio.

Both desktop runtimes can live in one project (kreft add electron tauri), and a project can have desktop and phone targets together (kreft new my-app --mobile --electron). They share your pages. See Desktop configuration for the settings file each one reads.

#What each target needs

TargetYou need installed
WebNode.js 22.5 or newer
ElectronNode.js (Electron and electron-builder come with kreft add electron)
TauriNode.js and Rust; on Linux the WebKitGTK libraries; on Windows the Visual Studio C++ build tools
AndroidAndroid Studio and a Java from 21 to 23
iOSA Mac with Xcode
HarmonyOSDevEco Studio (and a Huawei developer account to sign for a real device)

Build a desktop installer on the system it is for: a macOS installer needs a Mac, a Windows installer is best built on Windows, a Linux one on Linux.

#What is different on each target

  • The backend does not run inside an app. A desktop or phone app holds your built pages. Point the API client at a server you host (for phones, build with --api-url https://…). See Desktop apps with Electron and Mobile apps.
  • The address style. A packaged app loads its pages from files, so the router uses mode: 'hash' there; harmony:init sets that up so the website keeps its normal addresses.
  • The native bridge differs. Electron gives pages window.kreftDesktop; Tauri gives window.__TAURI__; the phone apps give Kreftjs.native (camera, files, share, haptics…). Write the page once and ask which one it is running in:
JS
if (Kreftjs.isElectron) {            // an Electron window
  kreftDesktop.notify('Saved', 'Your note was saved.')
} else if (Kreftjs.isTauri) {        // a Tauri window
  window.__TAURI__.event.emit('saved')
} else if (Kreftjs.native.isNative()) {  // an iOS or Android app
  Kreftjs.native.system.share({ text: 'Hello' })
}

Kreftjs.native.platform()    // 'ios' | 'android' | 'electron' | 'tauri' | 'web'
Kreftjs.native.isDesktop()   // true in Electron and Tauri

HarmonyOS apps run your pages in a web view, so they behave as the web there; use feature checks ('share' in navigator) for anything that depends on the device.

#TV apps (coming soon)

TV apps are planned and not available yet. Kreft has no TV packaging and no remote-control navigation today. What is planned:

TargetPlan
Android TVThe Android app, with a remote-control (D-pad) focus ring and a TV layout kit
Apple tvOSA tvOS shell around the same pages
LG webOSA packaged web app for LG TVs
Samsung TizenA packaged web app for Samsung TVs

There is no release date, and nothing here is promised until it ships and is tested. Until then, a TV that has a web browser can open your website; that is not a packaged TV app and has no focus handling for a remote.

#Platform commands at a glance

I want to…Command
Add Electron or Tauri to an appkreft add electron, kreft add tauri, or kreft add electron tauri
Check the desktop settingskreft electron:config, kreft tauri:config
Run a desktop appkreft electron:dev, kreft tauri:dev
Make desktop installerskreft electron:build [--mac] [--win] [--linux], kreft tauri:build
Add phone supportkreft new my-app --mobile, or kreft mobile:init
Run on a phone or emulatorkreft mobile:run --android, kreft mobile:run --ios, kreft mobile:dev
Add HarmonyOSkreft new my-app --harmony, or kreft harmony:init
Build and open HarmonyOSkreft harmony:build --api-url https://…, kreft harmony:open
Release a phone appkreft mobile:release --android, --ios, --harmony; the steps are in Publishing your app to Google Play and the App Store