Panel / Side Panels - 图1

Panel React Component

Panel React component represents Side Panels component.

Panel Components

There are following components included:

  • **Panel** / **F7Panel** - Panel element

Panel Properties

PropTypeDefaultDescription
sidestringPanel side. Could be left or right
leftbooleanShortcut prop for side=”left”
rightbooleanShortcut prop for side=”right”
effectstringPanel effect. Could be cover or reveal
coverbooleanShortcut prop for effect=”cover”
revealbooleanShortcut prop for effect=”reveal”
openedbooleanAllows to open/close panel and set its initial state

Panel Methods

.open(animate)Open panel
.close(animate)Close panel

Panel Events

EventDescription
panelOpenEvent will be triggered when Panel starts its opening animation
panelOpenedEvent will be triggered after Panel completes its opening animation
panelCloseEvent will be triggered when Panel starts its closing animation
panelClosedEvent will be triggered after Panel completes its closing animation
panelBackdropClickEvent will be triggered when the panel backdrop is clicked
panelSwipeEvent will be triggered for swipe panels during touch swipe action
panelSwipeOpenEvent will be triggered in the very beginning of opening it with swipe
panelBreakpointEvent will be triggered when it becomes visible/hidden when app width matches its breakpoint

Open And Close Panel

You can control panel state, open and closing it:

  • using Panel API
  • by passing true or false to its opened prop
  • by clicking on Link or Button with relevant panelOpen property (to open it) and panelClose property to close it

Access To Panel Instance

You can access Panel initialized instance by accessing **.f7Panel** component’s property.

Examples

  1. <App>
  2. {/* Left Panel with Reveal effect */}
  3. <Panel left reveal>
  4. <View>
  5. <Page>
  6. <Block>Left panel content</Block>
  7. </Page>
  8. </View>
  9. </Panel>
  10. {/* Right Panel with Cover effect and dark layout theme */}
  11. <Panel right themeDark>
  12. <View>
  13. <Page>
  14. <Block>Right panel content</Block>
  15. </Page>
  16. </View>
  17. </Panel>
  18. {/* Main view */}
  19. <View main>
  20. <Page>
  21. <Navbar title="Panel"></Navbar>
  22. <Block className="row">
  23. <Col>
  24. <Button raised panelOpen="left">Open left panel</Button>
  25. </Col>
  26. <Col>
  27. <Button raised panelOpen="right">Open right panel</Button>
  28. </Col>
  29. </Block>
  30. </Page>
  31. </View>
  32. </App>