Accordion - 图1

Accordion React Component

Accordion React component represents Framework7’s Accordion component.

Accordion Components

There are following components included:

  • Accordion / F7Accordion
  • AccordionItem / F7AccordionItem
  • AccordionToggle / F7AccordionToggle
  • AccordionContent / F7AccordionContent

Accordion Properties

PropTypeDefaultDescription
<AccordionItem> properties
openedbooleanMakes accordion item opened

Accordion Events

EventDescription
<AccordionItem> events
accordionBeforeOpenEvent will be triggered right before accordion content starts its opening animation. First handler argument receives prevent function that will prevent accordion from opening when called.
accordionOpenEvent will be triggered when accordion content starts its opening animation.
accordionOpenedEvent will be triggered after accordion content completes its opening animation.
accordionBeforeCloseEvent will be triggered right before accordion content starts its closing animation. First handler argument receives prevent function that will prevent accordion from closing when called.
accordionCloseEvent will be triggered when accordion content starts its closing animation.
accordionClosedEvent will be triggered after accordion content completes its closing animation.

Accordion List

Accordion List is not a separate component, but just a particular case of using <List>, <ListItem> and <AccordionContent> components.

In this case accordion events will be fired on ListItem.

Examples

  1. export default () => (
  2. <Page>
  3. <Navbar title="Accordion"/>
  4. <BlockTitle>List View Accordion</BlockTitle>
  5. <List accordionList>
  6. <ListItem accordionItem title="Lorem Ipsum">
  7. <AccordionContent>
  8. <Block>
  9. <p>
  10. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  11. </p>
  12. </Block>
  13. </AccordionContent>
  14. </ListItem>
  15. <ListItem accordionItem title="Nested List">
  16. <AccordionContent>
  17. <List>
  18. <ListItem title="Item 1"></ListItem>
  19. <ListItem title="Item 2"></ListItem>
  20. <ListItem title="Item 3"></ListItem>
  21. <ListItem title="Item 4"></ListItem>
  22. </List>
  23. </AccordionContent>
  24. </ListItem>
  25. <ListItem accordionItem title="Integer semper">
  26. <AccordionContent>
  27. <Block>
  28. <p>
  29. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  30. </p>
  31. </Block>
  32. </AccordionContent>
  33. </ListItem>
  34. </List>
  35. <BlockTitle>Inset Accordion</BlockTitle>
  36. <List accordionList inset>
  37. <ListItem accordionItem title="Lorem Ipsum">
  38. <AccordionContent>
  39. <Block>
  40. <p>
  41. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  42. </p>
  43. </Block>
  44. </AccordionContent>
  45. </ListItem>
  46. <ListItem accordionItem title="Nested List">
  47. <AccordionContent>
  48. <List>
  49. <ListItem title="Item 1"></ListItem>
  50. <ListItem title="Item 2"></ListItem>
  51. <ListItem title="Item 3"></ListItem>
  52. <ListItem title="Item 4"></ListItem>
  53. </List>
  54. </AccordionContent>
  55. </ListItem>
  56. <ListItem accordionItem title="Integer semper">
  57. <AccordionContent>
  58. <Block>
  59. <p>
  60. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  61. </p>
  62. </Block>
  63. </AccordionContent>
  64. </ListItem>
  65. </List>
  66. <BlockTitle>Opposite Side</BlockTitle>
  67. <List accordionList accordionOpposite>
  68. <ListItem accordionItem title="Lorem Ipsum">
  69. <AccordionContent>
  70. <Block>
  71. <p>
  72. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  73. </p>
  74. </Block>
  75. </AccordionContent>
  76. </ListItem>
  77. <ListItem accordionItem title="Nested List">
  78. <AccordionContent>
  79. <List>
  80. <ListItem title="Item 1"></ListItem>
  81. <ListItem title="Item 2"></ListItem>
  82. <ListItem title="Item 3"></ListItem>
  83. <ListItem title="Item 4"></ListItem>
  84. </List>
  85. </AccordionContent>
  86. </ListItem>
  87. <ListItem accordionItem title="Integer semper">
  88. <AccordionContent>
  89. <Block>
  90. <p>
  91. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum id neque nec commodo. Sed vel justo at turpis laoreet pellentesque quis sed lorem. Integer semper arcu nibh, non mollis arcu tempor vel. Sed pharetra tortor vitae est rhoncus, vel congue dui sollicitudin. Donec eu arcu dignissim felis viverra blandit suscipit eget ipsum.
  92. </p>
  93. </Block>
  94. </AccordionContent>
  95. </ListItem>
  96. </List>
  97. <BlockTitle>Custom Collapsible</BlockTitle>
  98. <Block inner accordionList>
  99. {Array.from(Array(3).keys()).map(n => (
  100. <AccordionItem key={n}>
  101. <AccordionToggle><b>Item {n + 1}</b></AccordionToggle>
  102. <AccordionContent>Content {n + 1}</AccordionContent>
  103. </AccordionItem>
  104. ))}
  105. </Block>
  106. </Page>
  107. );

← App

Action Sheet / Actions →