Documentation
Base
Page

Page

Description

The Page component represents a single page in a story. It manages its visibility, transitions, and interactions. This component leverages multiple hooks to handle context values and states, ensuring seamless integration and functionality within the story.

Properties

Component

PropTypeDescription
durationnumberThe duration of the page.
preloadbooleanWhether to preload the page.
prioritybooleanWhether the page has priority for visibility if page is disabled.
asReact.ElementTypeSpecifies the component type to render (by default, article)
...eventsStoryEventsOptional callback events for component.
...propsReact.HTMLAttributesStandard HTML Element attributes.

Events

EventTypeDescription
onOpenFunctionFunction to be called when the page opens in viewer.
onCloseFunctionFunction to be called when the page closes in viewer.

States

  1. Priority (classname: .instastories-page--priority)
  2. Disabled (classname: .instastories-page--disabled)
    • Component sets aria-disabled to true, by default.

Contexts Available

Usage

<Page
  preload
  priority
  duration={20000}
  onOpen={() => console.debug("Page opened!")}
  onClose={() => console.debug("Page closed!")}
>
  <h1>Page Content</h1>
</Page>

Demo