new ScreenJSONUI(...), auto-mounted from a CDN script tag, or passed as Svelte props — supports the same option set.
ScreenJSONUIConfig
| Option | Type | Default | Description |
|---|---|---|---|
element | string | HTMLElement | — required | Mount point. String is treated as an id. |
src | string | — | URL to fetch the ScreenJSON document from. |
document | ScreenJSONDocument | — | Pre-loaded document. Takes precedence over src. |
theme | 'light' | 'dark' | 'light' | Initial theme. |
zoom | number | 1 | 0.5 – 2. |
lang | Lang | document lang | BCP 47 tag for which text key to render. |
page | number | 1 | Initial page (1-based). |
numbered | boolean | false | Show scene numbers in the margin. |
paginated | boolean | true | Show page numbers. |
corner | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-right' | Menu button position. |
virtual | boolean | false | Use virtual scrolling — required for 50+ page documents. |
password | string | — | Password for encrypted content. If omitted on an encrypted document, the viewer opens a PasswordModal. |
onLoad | (doc: ScreenJSONDocument) => void | — | Called once on successful load. |
onPageChange | (page: number) => void | — | Called on every page change. |
onError | (err: LoaderError) => void | — | Called on fetch / parse / decrypt error. |
Theme
Lang
BCP 47 language tag string — e.g. en, en-GB, fr-CA, ja, zh-Hant.
Formatting constants
The viewer exports formatting constants fromscreenjson-ui/constants/formatting: