Skip to main content

useEpg hook

Description how to use the useEpg hook in Planby.

Options

Available options in useEpg

info

Without declaring the width and length properties, the component takes the dimensions of the parent element.

PropertyTypeStatusDescription
channelsarrayrequiredArray with channels data
epgarrayrequiredArray with EPG data
widthnumberoptionalEPG width
heightnumberoptionalEPG height
sidebarWidthnumberoptionalWidth of the sidebar with channels
timelineHeightnumberoptionalHeight of the timeline
itemHeightnumberoptionalHeight of channels and programs in the EPG. Default value is 80
dayWidthnumberoptionalWidth of the day. Default value is 7200. Calculation to set up day width with own hour width value e.g., 24h * 300px (your custom hour width) = 7200px -> dayWidth
startDatestringoptionalDate format 2024/02/02 or 2024-02-02T00:00:00. You can set your own start time, e.g., 2024-02-02T10:00:00, 2024-02-02T14:00:00, etc. Full clock hours only
endDatestringoptionalDate format 2024-02-02T00:00:00, 2024-02-02T20:00:00, etc. Must be within the same 24-hour period as startDate. Full clock hours only. Scroll through multiple days and timeline mode is available only in PRO plan.
timelineDividersnumberoptionalSet own dividers to Timeline and Grid bg. Default value is 4.
hoursInDaysarrayoptionalSet start time and end time of each day in multiple days feature if your data for each day has some time spaces between items in the day.
initialScrollPositionsobjectoptionalSet initial scroll position in Layout, e.g., initialScrollPositions: { top: 500, left: 800 }
liveRefreshTimenumberoptionalLive refresh time of the events. Default value is 120 sec.
isBaseTimeFormatbooleanoptionalConvert to 12-hour format, e.g., 2:00am, 4:00pm, etc. Default value is false.
isCurrentTimebooleanoptionalShow current time in Timeline. Default value is false.
isInitialScrollToNowbooleanoptionalScroll to the current live element.
isVerticalModebooleanoptionalShow Timeline in vertical view. Default value is false.
isResizebooleanoptionalPossibility to resize the element.
isSidebarbooleanoptionalShow/hide sidebar
isTimelinebooleanoptionalShow/hide timeline
isLinebooleanoptionalShow/hide line
isRTLbooleanoptionalChange direction to RTL or LTR. Default value is false.
themeobjectoptionalObject with theme schema
timezoneobjectoptionalConvert and display data from UTC format to your own time zone
areasarrayoptionalArea gives possibilities to add field ranges to the Timeline layout.
modeobjectoptionalType values: day/week/month. Style values: default/modern Define the mode and style of the timeline. Default mode is day and style is default
overlapobjectoptionalEnable the element overlaps in the layout. Mode values: stack/layer, layerOverlapLevel: number
dnd - drag and dropobjectoptionalDrag and move the element in the layout. Mode values: row/multi-rows
snap - dnd snappingobjectoptionalActivate the snap option to facilitate Drag and Drop (DnD) or resize operations, ensuring alignment with specified snap values. Example value: snap:{x: 50, y: 75}
grid layoutobjectoptionalBackground grid on the layout. Mode hoverHighlight values: true/false, onGridItemClick: function with all the properties on clicked item grid, onGridItemDrop: function with all the properties on drop item grid
channelMapKeystringoptionalThe Channel uuid attribute can be controlled by prop. Key map gives a possibilities to use specific prop from own data instead of needing to map to uuid in own data
programChannelMapKeystringoptionalThe Programs channelUuid attributes can be controlled by prop. Key map gives a possibilities to use a specific prop from own data instead of needing to map to channelUuid in your data
globalStylesstringoptionalInject custom global styles and font. Font weight: 400,500,600. Default font is "Inter"
mobileobjectoptionalMobile layout view for channels and elements

Instance Properties

Properties returned from useEpg

PropertyTypeDescription
scrollYnumberCurrent scroll y value
scrollXnumberCurrent scroll x value
onScrollLeftfunction(value: number,fetchZoneEnabled:boolean)Default value is 300 ,fetchZoneEnabled: false . fetchZoneEnabled with value false will be enabled after scroll end.
onScrollRightfunction(value: number,fetchZoneEnabled:boolean)Default value is 300, fetchZoneEnabled: false . fetchZoneEnabled with value false will be enabled after scroll end.
onScrollToNowfunction()Scroll to current time/live programs
onScrollTopfunction(value: number,fetchZoneEnabled:boolean)Default value is 300
onScrollTofunction(left: number, top:number,fetchZoneEnabled:boolean)Default value: left:0, top: 0, fetchZoneEnabled: false, animated: false. fetchZoneEnabled with value false will be enabled after scroll end.
getLayoutDatafunction()Generate and get all the layout data
getDropItemDatafunction()Get converted item data after external drop into grid action
updateElementfunction(elementToUpdate: object, index?:number)Update single element data.