Accordion - 图1

Accordion Svelte Component

Accordion Svelte component represents Framework7’s Accordion component.

Accordion Components

There are following components included:

  • Accordion
  • AccordionItem
  • AccordionToggle
  • AccordionContent

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. <Page>
  2. <Navbar title="Accordion" />
  3. <BlockTitle>List View Accordion</BlockTitle>
  4. <List accordionList>
  5. <ListItem accordionItem title="Lorem Ipsum">
  6. <AccordionContent>
  7. <Block>
  8. <p>
  9. 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.
  10. </p>
  11. </Block>
  12. </AccordionContent>
  13. </ListItem>
  14. <ListItem accordionItem title="Nested List">
  15. <AccordionContent>
  16. <List>
  17. <ListItem title="Item 1"></ListItem>
  18. <ListItem title="Item 2"></ListItem>
  19. <ListItem title="Item 3"></ListItem>
  20. <ListItem title="Item 4"></ListItem>
  21. </List>
  22. </AccordionContent>
  23. </ListItem>
  24. <ListItem accordionItem title="Integer semper">
  25. <AccordionContent>
  26. <Block>
  27. <p>
  28. 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.
  29. </p>
  30. </Block>
  31. </AccordionContent>
  32. </ListItem>
  33. </List>
  34. <BlockTitle>Inset Accordion</BlockTitle>
  35. <List accordionList inset>
  36. <ListItem accordionItem title="Lorem Ipsum">
  37. <AccordionContent>
  38. <Block>
  39. <p>
  40. 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.
  41. </p>
  42. </Block>
  43. </AccordionContent>
  44. </ListItem>
  45. <ListItem accordionItem title="Nested List">
  46. <AccordionContent>
  47. <List>
  48. <ListItem title="Item 1"></ListItem>
  49. <ListItem title="Item 2"></ListItem>
  50. <ListItem title="Item 3"></ListItem>
  51. <ListItem title="Item 4"></ListItem>
  52. </List>
  53. </AccordionContent>
  54. </ListItem>
  55. <ListItem accordionItem title="Integer semper">
  56. <AccordionContent>
  57. <Block>
  58. <p>
  59. 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.
  60. </p>
  61. </Block>
  62. </AccordionContent>
  63. </ListItem>
  64. </List>
  65. <BlockTitle>Opposite Side</BlockTitle>
  66. <List accordionList accordionOpposite>
  67. <ListItem accordionItem title="Lorem Ipsum">
  68. <AccordionContent>
  69. <Block>
  70. <p>
  71. 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.
  72. </p>
  73. </Block>
  74. </AccordionContent>
  75. </ListItem>
  76. <ListItem accordionItem title="Nested List">
  77. <AccordionContent>
  78. <List>
  79. <ListItem title="Item 1"></ListItem>
  80. <ListItem title="Item 2"></ListItem>
  81. <ListItem title="Item 3"></ListItem>
  82. <ListItem title="Item 4"></ListItem>
  83. </List>
  84. </AccordionContent>
  85. </ListItem>
  86. <ListItem accordionItem title="Integer semper">
  87. <AccordionContent>
  88. <Block>
  89. <p>
  90. 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.
  91. </p>
  92. </Block>
  93. </AccordionContent>
  94. </ListItem>
  95. </List>
  96. <BlockTitle>Custom Collapsible</BlockTitle>
  97. <Block inner accordionList>
  98. {#each [1,2,3] as n}
  99. <AccordionItem >
  100. <AccordionToggle><b>Item {n}</b></AccordionToggle>
  101. <AccordionContent>Content {n}</AccordionContent>
  102. </AccordionItem>
  103. {/each}
  104. </Block>
  105. </Page>
  106. <script>
  107. import { Page, Navbar, Block, BlockTitle, List, ListItem, AccordionItem, AccordionContent, AccordionToggle } from 'framework7-svelte';
  108. </script>

← App

Action Sheet / Actions →