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.ElementDescription
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
| Name | Type | Description |
|---|---|---|
props | ITimeGridProps |
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,hdPosterUrlfor logo)- Program ContentNode per cell (with
title,description,playStart,playDuration)
- Program ContentNode per cell (with
- Channel ContentNode per row (with
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}`)}
/>| Name | Type | Description |
|---|---|---|
scrollSpeed? | number | Speed 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.
| Name | Type | Description |
|---|---|---|
focusChannelIndex | number | |
focusIndex | number |
ITimeGridGeneralProps
General TimeGrid settings that configure the overall time range, scrollable extent, and overlay appearance.
| Name | Type | Description |
|---|---|---|
autoDismissTime? | number | Time (in seconds) before the TimeGrid is automatically hidden. Setting to 0 prevents auto-hiding. |
contentStartTime? | number | The 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? | number | Width (in seconds) of the visible section of the time grid. For example, 10800 displays a 3-hour window (10,800 = 3 * 3,600). |
ignoreTrickPlayKeys? | boolean | When 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? | number | The total width of the TimeGrid in days. |
overlayBitmapUri? | Uri | Bitmap URI for an overlay drawn on top of the entire time grid. See below. |
overlayHeight? | number | Height 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.
| Name | Type | Description |
|---|---|---|
animateToChannel? | number | Write-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? | number | Index of the focused channel when a program in the channel's row gains focus. |
channelSelected? | number | Index of the selected channel (read-only, set on program selection). |
channelUnfocused? | number | Index of the focused channel when a program in the channel's row loses focus. |
jumpToChannel? | number | Write-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? | string | Write-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? | number | When 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.
| Name | Type | Description |
|---|---|---|
channelFocusedBitmapUri? | Uri | Bitmap displayed behind the focused channel info item. |
channelInfoAlignment? | "left" | "right" | Controls the position of the channel info column. |
channelInfoBackgroundBitmapUri? | Uri | Bitmap 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? | string | Text 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? | string | Name of the compiled component used to render each channel info cell. See below. |
channelInfoFocusable? | boolean | Whether the user can move focus into the channel information column. If false, the column is non-interactive. |
channelInfoFocused? | number | Index of the channel when a channel info item gains focus. |
channelInfoFont? | FontValue | Font for channel names when channelInfoComponentName is not specified. |
channelInfoSelected? | number | Index of the selected channel in the channel information column. |
channelInfoTextColor? | string | Text color for channel names when channelInfoComponentName is not specified. |
channelInfoUnfocused? | number | Index of the channel when a channel info item loses focus. |
channelInfoWidth? | number | Width of the channel info column, in pixels. |
channelNoDataComponentName? | string | Name of the compiled component shown when a channel has no program data. |
channelUnFocusedBitmapUri? | Uri | Bitmap displayed behind unfocused channel info items. |
infoGridGap? | number | Spacing between the channel information column and the main grid. |
jumpToChannelInfo? | number | Write-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.
| Name | Type | Description |
|---|---|---|
automaticLoadingDataFeedback? | boolean | When 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? | string | Text displayed on each channel row when no data exists for a specific time. |
fillProgramGaps? | boolean | When 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? | number | Write-only. Jumps the grid to the program at the specified index for the currently focused row. |
loadingDataText? | string | Text 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? | Uri | Bitmap file used as the background for program cells. In most cases, use a 9-patch image that specifies expandable regions. |
programFocused? | number | Index of the focused program in the currently focused channel row. |
programFocusedDetails? | ITimeGridProgramFocusedDetails | Combined channel index and program index when a program gains focus. Provides the same values as channelFocused and programFocused in a single object. |
programHorizMargin? | number | Width of the left and right margins of program cell text, in pixels. |
programInfoComponentName? | string | Name of the compiled component used to render focused program details. |
programSelected? | number | Index of the selected program in the currently focused channel row (read-only, set on OK press). |
programTitleColor? | string | Text color for unfocused program titles. |
programTitleFocusedColor? | string | Text color for the focused program title. |
programTitleFont? | FontValue | Font for program titles. |
programUnfocused? | number | Index of the program in the currently focused channel row when it loses focus. |
showLoadingDataFeedback? | boolean | When 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.
| Name | Type | Description |
|---|---|---|
pastTimeScreenBitmapUri? | Uri | Bitmap file displayed in the background of the past time screen. |
pastTimeScreenBlendColor? | string | Tints the past time screen by multiplying each pixel by this color. No blending is performed if set to the default value. |
showPastTimeScreen? | boolean | When 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.
| Name | Type | Description |
|---|---|---|
timeBarBackgroundColor? | string | Background color for the time bar. |
timeBarBitmapUri? | Uri | Bitmap file used as the background of the time bar. In most cases, use a 9-patch image that specifies expandable regions. |
timeBarHeight? | number | Height of the time bar region above the channel grid, in pixels. |
timeLabelColor? | string | Text color for the time labels displayed in the time bar. |
timeLabelFont? | FontValue | Font for the time labels displayed in the time bar. |
timeLabelOffset? | number | Offset 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.
| Name | Type | Description |
|---|---|---|
minimumNowBarOffset? | number | The 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? | Uri | Bitmap file used for the Now Bar. In most cases, use a 9-patch image that specifies expandable regions. |
nowBarBlendColor? | string | Tints the Now Bar by multiplying each pixel by this color. No blending is performed if set to the default value. |
nowBarHeight? | number | Height of the Now Bar, in pixels. |
nowBarOffset? | number | Number of pixels the left edge of the Now Bar is offset from the current time. |
nowBarWidth? | number | Width 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.
| Name | Type | Description |
|---|---|---|
nextBackgroundBitmapUri? | Uri | Bitmap file displayed in the background of the Next column. |
nowBackgroundBitmapUri? | Uri | Bitmap file displayed in the background of the Now column. |
nowNextHideAmPm? | boolean | When true, hides the AM/PM abbreviation next to times in Now/Next mode. |
nowNextMode? | boolean | When true, the time grid displays two vertical columns showing Now and Next programs for each channel. |
programNowNextHorizMargin? | number | Width of the left and right margins of program cell text in Now/Next mode, in pixels. |
programNowNextTimeColor? | string | Text color for program times in Now/Next cells when unfocused. |
programNowNextTimeFocusedColor? | string | Text color for program times in Now/Next cells when focused. |
programNowNextTimeTitleGap? | number | Gap between the Now and Next entries, in pixels. |
Updated about 5 hours ago