Skip to content
Eskais UI

Signs

Teletext

Teletext pages on a 40×25 grid in the eight broadcast colours: double-height rows, 2×3 mosaic block graphics, flash, a header with the page number, service and clock, and the four coloured Fastext keys. Type three digits to tune, and the counter searches the broadcast before the page shows; subpages rotate. It fills its parent at 4:3 and scales the grid to it, so it fits a TV's screen. Pages are data; each is a region with a heading and real text, with goToPage and fastext for agents.

Example

P100ESKAIS

ESKAIS TEXT INDEX

NEWS
Headlines .................. 101
Town and country ........... 102
Markets .................... 120
WEATHER
Today and tomorrow ......... 400
TELEVISION
Tonight on channel one ..... 600
Type three digits to choose a page.
Coloured keys follow the bottom row.
All stories and listings are fictional.

Installation

npx shadcn@latest add @eskais/teletext

Usage

Import
import { Teletext, teletextLabels } from "@/components/ui/teletext"import { teletext } from "@/components/ui/teletext-primitive"import {  cellsOf,  fastextColors,  firstPage,  fittedSpans,  lastPage,  normalRow,  pageColumns,  pageRows,  rowsOf,  subpageCount,  teletextMosaic,} from "@/components/ui/teletext-page"import { useTeletextClock } from "@/components/ui/use-teletext-clock"import { useTeletextSearch } from "@/components/ui/use-teletext-search"import { useTeletextSubpages } from "@/components/ui/use-teletext-subpages"

Reach for it for a retro information service, alone or inside a TV: listings, news, scores, weather, each a page of data. It fills its parent at 4:3; inside a RetroTv, pass screen="flat" and it fills the screen and keeps its eight colours, with the TV's switch-off over the page.

API reference

Teletext

PropTypeDefault
labelrequiredThe set's accessible name: "Teletext".string–
pagesrequiredThe service's pages by number, 100 to 899.Readonly<Record<number, TeletextPage>>–
serviceThe service's name on the header row, up to about ten characters.string""
clockShows the date and a running clock on the header row, in the page's locale. Default true.booleantrue
searchMsHow long the counter runs through the broadcast before a new page shows, in ms. 0 shows it at once. Default 900.number900
subpageMsHow long each subpage stays before the next, in ms. Default 12000.number12_000
screen`crt` (the default) adds scanlines and a darker rim, as a tube set had; `flat` leaves them to a screen it sits in."crt" | "flat""crt"
localeThe locale for the header's date and clock; the page's `lang` by default.string–
labelsPartial<TeletextLabels>–
classNameClasses for the set; a function gets the page shown and whether it's searching.string | ((state: TeletextState) => string | undefined)–

Also takes TeletextOptions except pages.

Other exports

teletextLabelsteletextcellsOffastextColorsfirstPagefittedSpanslastPagenormalRowpageColumnspageRowsrowsOfsubpageCountteletextMosaicuseTeletextClockuseTeletextSearchuseTeletextSubpagestype TeletextLabelstype TeletextPropstype TeletextStatetype TeletextOptionstype TeletextPageChangeReasontype FastextColortype FastextLinktype NormalRowtype TeletextColortype TeletextPagetype TeletextRowtype TeletextSpan

Accessibility

  • Each page is a region named by its title, with a heading; its text is real text and its mosaics are hidden from screen readers.
  • The page takes focus: three digits tune and Backspace takes one back, and Left and Right turn subpages, which hold still while it has focus or the pointer.
  • Fastext keys are buttons named by their words, with 44px touch targets. Flash and the search counter stop under reduced motion.

Agent actions

Agents find it by its label and call goToPage or fastext, or press a Fastext key by its word; a page the service doesn't have fails the step with the pages it has.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.