TimeGrid

TimeGrid is an EPG (Electronic Program Guide) component that displays a scrollable, time-based grid of TV channels and their programs

import { TimeGrid } from "@roku-sdk/components";
TimeGrid(props: ITimeGridProps): JSX.Element

Description

TimeGrid is an EPG (Electronic Program Guide) component that displays a scrollable, time-based grid of TV channels and their programs.

Each row represents a channel with a customizable info column on the left. Programs are laid out horizontally according to their playStart and playDuration content metadata. A time bar and optional "now" indicator provide temporal context.

Parameters

NameTypeDescription
propsITimeGridProps

Example

<timeGrid
    numRows={7}
    duration={7200}
    contentStartTime={startTime}
    leftEdgeTargetTime={now}
    channelInfoComponentName={channelItem}
    content={epgContent}
    onProgramSelected={(index) => handleSelection(index)}
/>

Types

ITimeGridProps

Properties for the TimeGrid node.

TimeGrid is an EPG (Electronic Program Guide) component that displays a time-based grid of channels and programs. Each row represents a channel, and each cell within a row represents a program with its time slot.

The content tree structure is:

  • Root ContentNode
    • Channel ContentNode per row (with title, hdPosterUrl for logo)
      • Program ContentNode per cell (with title, description, playStart, playDuration)

Program nodes use playStart (epoch seconds) and playDuration (seconds) to determine their horizontal position and width in the grid.

Example

<TimeGrid
    numRows={7}
    duration={7200}
    contentStartTime={startTime}
    leftEdgeTargetTime={now}
    channelInfoComponentName={channelItem}
    content={epgContent}
    onProgramSelected={(index) => console.log(`Selected program: ${index}`)}
/>
NameTypeDescription
scrollSpeed?numberSpeed of horizontal scrolling through the time axis.

Extends IArrayGridProps, ITimeGridGeneralProps, ITimeGridChannelProps, ITimeGridChannelInfoProps, ITimeGridProgramGridProps, ITimeGridPastTimeScreenProps, ITimeGridTimeBarProps, ITimeGridNowBarProps, ITimeGridNowNextModeProps.

ITimeGridProgramFocusedDetails

Focused details for a program in the TimeGrid, combining the channel index and program index into a single object.

NameTypeDescription
focusChannelIndexnumber
focusIndexnumber

ITimeGridGeneralProps

General TimeGrid settings that configure the overall time range, scrollable extent, and overlay appearance.

NameTypeDescription
autoDismissTime?numberTime (in seconds) before the TimeGrid is automatically hidden. Setting to 0 prevents auto-hiding.
contentStartTime?numberThe earliest time (in epoch seconds) that the TimeGrid can be scrolled to. The scrollable range is defined by the sum of contentStartTime and maxDays.
duration?numberWidth (in seconds) of the visible section of the time grid. For example, 10800 displays a 3-hour window (10,800 = 3 * 3,600).
ignoreTrickPlayKeys?booleanWhen true, ignores fast forward, rewind, and instant replay key events. FF/RW normally page the grid up/down; instant replay jumps to the current time.
maxDays?numberThe total width of the TimeGrid in days.
overlayBitmapUri?UriBitmap URI for an overlay drawn on top of the entire time grid. See below.
overlayHeight?numberHeight of the overlay image. If 0, the overlay is drawn at its default height.

ITimeGridGeneralProps.overlayBitmapUri

Bitmap URI for an overlay drawn on top of the entire time grid. Used by default to make bottom rows appear to fade out. In most cases, use a 9-patch image that specifies expandable regions.

The overlay is drawn at full grid width with its bottom aligned to the grid bottom. If overlayHeight is greater than 0, the image is stretched to that height.

ITimeGridChannelProps

Channel-level navigation, focus, and selection settings.

NameTypeDescription
animateToChannel?numberWrite-only. Scrolls the grid with animation so the row corresponding to the specified channel index is on screen. When scrolling ends, the program in that row at the current focus time will have focus.
channelFocused?numberIndex of the focused channel when a program in the channel's row gains focus.
channelSelected?numberIndex of the selected channel (read-only, set on program selection).
channelUnfocused?numberIndex of the focused channel when a program in the channel's row loses focus.
jumpToChannel?numberWrite-only. Jumps the grid so the row corresponding to the specified channel index is on screen. The program in that row at the current focus time will have focus.
jumpToTime?stringWrite-only. Jumps the grid to the program at the specified time (in UTC format). After the jump, the time will be visible and the program on the currently focused channel will have focus.
leftEdgeTargetTime?numberWhen explicitly set, triggers a horizontal scrolling animation so that the specified time is displayed at the left edge of the program grid. See below.
onChannelFocused?EventHandler<number>Fired when the focused channel changes.
onChannelSelected?EventHandler<number>Fired when a channel is selected.
onChannelUnfocused?EventHandler<number>Fired when a channel loses focus.

ITimeGridChannelProps.leftEdgeTargetTime

When explicitly set, triggers a horizontal scrolling animation so that the specified time is displayed at the left edge of the program grid.

Also set by the firmware in response to remote control key presses that cause horizontal scrolling.

ITimeGridChannelInfoProps

Configuration for the channel information column displayed on the left (or right) side of the EPG that lists channel names/logos.

NameTypeDescription
channelFocusedBitmapUri?UriBitmap displayed behind the focused channel info item.
channelInfoAlignment?"left" | "right"Controls the position of the channel info column.
channelInfoBackgroundBitmapUri?UriBitmap file used as the background for channel names when channelInfoComponentName is not specified. In most cases, use a 9-patch image that specifies expandable regions.
channelInfoColumnLabel?stringText used as a label for the header of the channel information column. If not specified, the label shows the day of the week at the left edge.
channelInfoComponentName?stringName of the compiled component used to render each channel info cell. See below.
channelInfoFocusable?booleanWhether the user can move focus into the channel information column. If false, the column is non-interactive.
channelInfoFocused?numberIndex of the channel when a channel info item gains focus.
channelInfoFont?FontValueFont for channel names when channelInfoComponentName is not specified.
channelInfoSelected?numberIndex of the selected channel in the channel information column.
channelInfoTextColor?stringText color for channel names when channelInfoComponentName is not specified.
channelInfoUnfocused?numberIndex of the channel when a channel info item loses focus.
channelInfoWidth?numberWidth of the channel info column, in pixels.
channelNoDataComponentName?stringName of the compiled component shown when a channel has no program data.
channelUnFocusedBitmapUri?UriBitmap displayed behind unfocused channel info items.
infoGridGap?numberSpacing between the channel information column and the main grid.
jumpToChannelInfo?numberWrite-only. Jumps the grid to the channel info box of the specified channel index. Ignored if channelInfoFocusable is false.
onChannelInfoFocused?EventHandler<number>Fired when a channel info item gains focus.
onChannelInfoSelected?EventHandler<number>Fired when a channel info item is selected.
onChannelInfoUnfocused?EventHandler<number>Fired when a channel info item loses focus.

ITimeGridChannelInfoProps.channelInfoComponentName

Name of the compiled component used to render each channel info cell. The component's content field receives channel data.

If not specified, the default channel info is displayed (optional icon + label).

ITimeGridProgramGridProps

Configuration for program titles, cells, data loading, and program focus/selection events in the EPG grid.

NameTypeDescription
automaticLoadingDataFeedback?booleanWhen true, the program data region is automatically replaced with the loading message whenever content has not been set or the user scrolls to a time where content has not yet been loaded.
channelNoDataText?stringText displayed on each channel row when no data exists for a specific time.
fillProgramGaps?booleanWhen true, inserts a placeholder cell with the "No Data Available" label if there is a gap between a program's start time and the previous program's end time.
jumpToProgram?numberWrite-only. Jumps the grid to the program at the specified index for the currently focused row.
loadingDataText?stringText displayed over the program grid when the loading message is shown.
onProgramFocused?EventHandler<number>Fired when the focused program changes.
onProgramFocusedDetails?EventHandler<ITimeGridProgramFocusedDetails>Fired when program focused details change.
onProgramSelected?EventHandler<number>Fired when a program is selected.
onProgramUnfocused?EventHandler<number>Fired when a program loses focus.
programBackgroundBitmapUri?UriBitmap file used as the background for program cells. In most cases, use a 9-patch image that specifies expandable regions.
programFocused?numberIndex of the focused program in the currently focused channel row.
programFocusedDetails?ITimeGridProgramFocusedDetailsCombined channel index and program index when a program gains focus. Provides the same values as channelFocused and programFocused in a single object.
programHorizMargin?numberWidth of the left and right margins of program cell text, in pixels.
programInfoComponentName?stringName of the compiled component used to render focused program details.
programSelected?numberIndex of the selected program in the currently focused channel row (read-only, set on OK press).
programTitleColor?stringText color for unfocused program titles.
programTitleFocusedColor?stringText color for the focused program title.
programTitleFont?FontValueFont for program titles.
programUnfocused?numberIndex of the program in the currently focused channel row when it loses focus.
showLoadingDataFeedback?booleanWhen true, replaces the program data region with the loading message. Enables explicit control over when the loading message is displayed. Ignored if automaticLoadingDataFeedback is true.

ITimeGridPastTimeScreenProps

Configuration for the solid color background drawn behind all programs airing before the current time.

NameTypeDescription
pastTimeScreenBitmapUri?UriBitmap file displayed in the background of the past time screen.
pastTimeScreenBlendColor?stringTints the past time screen by multiplying each pixel by this color. No blending is performed if set to the default value.
showPastTimeScreen?booleanWhen true, draws a solid color background behind all programs airing before the current time.

ITimeGridTimeBarProps

Configuration for the time bar displayed horizontally above the program cells.

NameTypeDescription
timeBarBackgroundColor?stringBackground color for the time bar.
timeBarBitmapUri?UriBitmap file used as the background of the time bar. In most cases, use a 9-patch image that specifies expandable regions.
timeBarHeight?numberHeight of the time bar region above the channel grid, in pixels.
timeLabelColor?stringText color for the time labels displayed in the time bar.
timeLabelFont?FontValueFont for the time labels displayed in the time bar.
timeLabelOffset?numberOffset from the edge of the grid of the leftmost time label, in pixels.

ITimeGridNowBarProps

Configuration for the thin vertical bar displayed at the current time.

NameTypeDescription
minimumNowBarOffset?numberThe nearest (in seconds) that the Now Bar can be to the left edge of the time grid. If the Now Bar advances to this value plus 30 minutes, the grid auto-scrolls right 30 minutes.
nowBarBitmapUri?UriBitmap file used for the Now Bar. In most cases, use a 9-patch image that specifies expandable regions.
nowBarBlendColor?stringTints the Now Bar by multiplying each pixel by this color. No blending is performed if set to the default value.
nowBarHeight?numberHeight of the Now Bar, in pixels.
nowBarOffset?numberNumber of pixels the left edge of the Now Bar is offset from the current time.
nowBarWidth?numberWidth of the Now Bar, in pixels.

ITimeGridNowNextModeProps

Configuration for Now/Next mode, where the program grid only shows "Now" and "Next" columns listing current and subsequent programs.

NameTypeDescription
nextBackgroundBitmapUri?UriBitmap file displayed in the background of the Next column.
nowBackgroundBitmapUri?UriBitmap file displayed in the background of the Now column.
nowNextHideAmPm?booleanWhen true, hides the AM/PM abbreviation next to times in Now/Next mode.
nowNextMode?booleanWhen true, the time grid displays two vertical columns showing Now and Next programs for each channel.
programNowNextHorizMargin?numberWidth of the left and right margins of program cell text in Now/Next mode, in pixels.
programNowNextTimeColor?stringText color for program times in Now/Next cells when unfocused.
programNowNextTimeFocusedColor?stringText color for program times in Now/Next cells when focused.
programNowNextTimeTitleGap?numberGap between the Now and Next entries, in pixels.

What’s Next

Did this page help you?