List View - 图1

List React Component

List views are versatile and powerful user interface compontents frequently found in iOS apps. A list view presents data in a scrollable list of multiple rows that may be divided into sections/groups.

List views have many purposes:

  • To let users navigate through hierarchically structured data
  • To present an indexed list of items
  • To display detail information and controls in visually distinct groupings
  • To present a selectable list of options

List React component represents Framework7’s List View component.

List Components

There are following components included:

  • **List** / **F7List** - main List View element
  • **ListGroup** / **F7ListGroup** - list group element

List Properties

PropTypeDefaultDescription
<List> properties
insetbooleanfalseMakes list block inset
tabletInsetbooleanfalseMakes block inset on tablets, but not on phones
mediaListbooleanfalseEnables Media List
linksListbooleanfalseEnables simplified Links List
simpleListbooleanfalseEnables simplified Simple List
sortablebooleanfalseEnables Sortable List
sortableEnabledbooleanfalseEnables sorting on sortable list
sortableMoveElementsbooleanWhen passed it will overwrite same sortable.moveElements global app parameter.
accordionbooleanfalseEnables Accordion List
contactsListbooleanfalseEnables Contacts List by adding required addional classes for styling
formbooleanfalseEnables <form> tag on list block instead of <div>
formStoreDatabooleanfalseEnables form storage for the current form
inlineLabelsbooleanfalseEnables inline-styled labels for Form Inputs
noChevronbooleanfalseRemoves “chevron” icon on nested list item links
chevronCenterbooleanfalseSets “chevron” icon on nested media list items on center (vertically)
noHairlinesbooleanfalseRemoves outer hairlines
noHairlinesMdbooleanfalseRemoves outer hairlines for MD theme
noHairlinesIosbooleanfalseRemoves outer hairlines for iOS theme
noHairlinesBetweenbooleanfalseRemoves inner hairlines between items
noHairlinesBetweenMdbooleanfalseRemoves inner hairlines between items for MD theme
noHairlinesBetweenIosbooleanfalseRemoves inner hairlines between items for iOS theme
tabbooleanfalseAdds additional “tab” class when block should be used as a Tab
tabActivebooleanfalseAdds additional “tab-active” class when block used as a Tab and makes it active tab
virtualListbooleanfalseEnables Virtual List
virtualListParamsobjectObject with Virtual List Parameters
<ListGroup> properties
mediaListbooleanfalseEnables Media List for this group
sortablebooleanfalseEnables Sortable List for this group
simpleListbooleanfalseEnables simplified Simple List for this group

List Events

EventDescription
<List> events
tabShowEvent will be triggered when List Block-Tab becomes visible/active
tabHideEvent will be triggered when List Block-Tab becomes invisible/inactive
submitEvent will be triggered on list-form submit when list used as form (with enabled form prop)
<List> Sortable specific events
sortableEnableEvent will be triggered when sortable mode is enabled
sortableDisableEvent will be triggered when sortable mode is disabled
sortableSortEvent will be triggered after user release currently sorting element in new position. event.detail will contain object with from and to properties with start/new index numbers of sorted list item
<List> Virtual List specific events
virtualItemBeforeInsertEvent will be triggered before item will be added to virtual document fragment
virtualItemsBeforeInsertEvent will be triggered after current DOM list will be removed and before new document will be inserted
virtualItemsAfterInsertEvent will be triggered after new document fragment with items inserted
virtualBeforeClearEvent will be triggered before current DOM list will be removed and replaced with new document fragment

List Slots

List React component (<List>) has additional slots for custom elements:

  • **before-list** - element will be inserted in the beginning of list view and right before <ul> main list
  • **after-list** - element will be inserted in the end of list view and right after <ul> main list
  • **list** - element will be inserted inside of <ul> main list element

Virtual List

For Virtual List usage and examples check the Virtual List React Component documentation.

Sortable List

For Sortable List usage and examples check the Sortable React Component documentation.

Accordion List

For Accordion List usage and examples check the Accordion React Component documentation.

Examples

Simple List

  1. <BlockTitle>Simple List</BlockTitle>
  2. <List simple-list>
  3. <ListItem title="Item 1"></ListItem>
  4. <ListItem title="Item 2"></ListItem>
  5. <ListItem title="Item 3"></ListItem>
  6. </List>

Simple List Links

  1. <BlockTitle>Simple Links List</BlockTitle>
  2. <List>
  3. <ListItem title="Link 1" link="#"></ListItem>
  4. <ListItem title="Link 2" link="#"></ListItem>
  5. <ListItem title="Link 3" link="#"></ListItem>
  6. </List>

Data list, with icons

  1. <BlockTitle>Data list, with icons</BlockTitle>
  2. <List>
  3. <ListItem title="Ivan Petrov" after="CEO">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem title="John Doe" badge="5">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. </ListItem>
  9. <ListItem title="Jenna Smith">
  10. <Icon slot="media" icon="demo-list-icon"></Icon>
  11. </ListItem>
  12. </List>

Links

  1. <BlockTitle>Links</BlockTitle>
  2. <List>
  3. <ListItem link="#" title="Ivan Petrov" after="CEO">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem link="#" title="John Doe" after="Cleaner">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. </ListItem>
  9. <ListItem link="#" title="Jenna Smith">
  10. <Icon slot="media" icon="demo-list-icon"></Icon>
  11. </ListItem>
  12. </List>

Links, Header, Footer

  1. <BlockTitle>Links, Header, Footer</BlockTitle>
  2. <List>
  3. <ListItem link="#" header="Name" title="John Doe" after="Edit">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem link="#" header="Phone" title="+7 90 111-22-3344" after="Edit">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. </ListItem>
  9. <ListItem link="#" header="Email" title="john@doe" footer="Home" after="Edit">
  10. <Icon slot="media" icon="demo-list-icon"></Icon>
  11. </ListItem>
  12. <ListItem link="#" header="Email" title="john@framework7" footer="Work" after="Edit">
  13. <Icon slot="media" icon="demo-list-icon"></Icon>
  14. </ListItem>
  15. </List>

Links, no icons

  1. <BlockTitle>Links, no icons</BlockTitle>
  2. <List>
  3. <ListItem link="#" title="Ivan Petrov"></ListItem>
  4. <ListItem link="#" title="John Doe"></ListItem>
  5. <ListItem divider title="Divider Here"></ListItem>
  6. <ListItem link="#" title="Ivan Petrov"></ListItem>
  7. <ListItem link="#" title="Jenna Smith"></ListItem>
  8. </List>

Grouped with sticky titles

  1. <BlockTitle>Grouped with sticky titles</BlockTitle>
  2. <List>
  3. <ListGroup>
  4. <ListItem title="A" groupTitle></ListItem>
  5. <ListItem title="Aaron "></ListItem>
  6. <ListItem title="Abbie"></ListItem>
  7. <ListItem title="Adam"></ListItem>
  8. </ListGroup>
  9. <ListGroup>
  10. <ListItem title="B" groupTitle></ListItem>
  11. <ListItem title="Bailey"></ListItem>
  12. <ListItem title="Barclay"></ListItem>
  13. <ListItem title="Bartolo"></ListItem>
  14. </ListGroup>
  15. <ListGroup>
  16. <ListItem title="C" groupTitle></ListItem>
  17. <ListItem title="Caiden"></ListItem>
  18. <ListItem title="Calvin"></ListItem>
  19. <ListItem title="Candy"></ListItem>
  20. </ListGroup>
  21. </List>

Mixed and nested

  1. <BlockTitle>Mixed and nested</BlockTitle>
  2. <List>
  3. <ListItem link="#" title="Ivan Petrov" after="CEO">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem link="#" title="Two icons here">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. <Icon slot="media" icon="demo-list-icon"></Icon>
  9. </ListItem>
  10. <ListItem title="No icons here"></ListItem>
  11. <li>
  12. <ul>
  13. <ListItem link="#" title="Ivan Petrov" after="CEO">
  14. <Icon slot="media" icon="demo-list-icon"></Icon>
  15. </ListItem>
  16. <ListItem link="#" title="Two icons here">
  17. <Icon slot="media" icon="demo-list-icon"></Icon>
  18. <Icon slot="media" icon="demo-list-icon"></Icon>
  19. </ListItem>
  20. <ListItem title="No icons here"></ListItem>
  21. <ListItem link="#" title="Ultra long text goes here, no, it is really really long">
  22. <Icon slot="media" icon="demo-list-icon"></Icon>
  23. </ListItem>
  24. <ListItem title="With toggle">
  25. <Icon slot="media" icon="demo-list-icon"></Icon>
  26. <Toggle slot="after"></Toggle>
  27. </ListItem>
  28. </ul>
  29. </li>
  30. <ListItem link="#" title="Ultra long text goes here, no, it is really really long">
  31. <Icon slot="media" icon="demo-list-icon"></Icon>
  32. </ListItem>
  33. <ListItem title="With toggle">
  34. <Icon slot="media" icon="demo-list-icon"></Icon>
  35. <Toggle slot="after"></Toggle>
  36. </ListItem>
  37. </List>

Mixed, inset

  1. <BlockTitle>Mixed, inset</BlockTitle>
  2. <List>
  3. <ListItem link="#" title="Ivan Petrov" after="CEO">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem link="#" title="Two icons here">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. <Icon slot="media" icon="demo-list-icon"></Icon>
  9. </ListItem>
  10. <ListItem link="#" title="Ultra long text goes here, no, it is really really long">
  11. <Icon slot="media" icon="demo-list-icon"></Icon>
  12. </ListItem>
  13. <ListItem title="With toggle">
  14. <Icon slot="media" icon="demo-list-icon"></Icon>
  15. <Toggle slot="after"></Toggle>
  16. </ListItem>
  17. <BlockFooter>
  18. <p>Here comes some useful information about list above</p>
  19. </BlockFooter>
  20. </List>

Tablet inset

  1. <BlockTitle>Tablet inset</BlockTitle>
  2. <List tabletInset>
  3. <ListItem link="#" title="Ivan Petrov" after="CEO">
  4. <Icon slot="media" icon="demo-list-icon"></Icon>
  5. </ListItem>
  6. <ListItem link="#" title="Two icons here">
  7. <Icon slot="media" icon="demo-list-icon"></Icon>
  8. <Icon slot="media" icon="demo-list-icon"></Icon>
  9. </ListItem>
  10. <ListItem link="#" title="Ultra long text goes here, no, it is really really long">
  11. <Icon slot="media" icon="demo-list-icon"></Icon>
  12. </ListItem>
  13. <BlockFooter>
  14. <p>This list block will look like "inset" only on tablets (iPad)</p>
  15. </BlockFooter>
  16. </List>

Media Lists

  1. <BlockTitle>Media Lists</BlockTitle>
  2. <Block>
  3. <p>Media Lists are almost the same as Data Lists, but with a more flexible layout for visualization of more complex data, like products, services, userc, etc.</p>
  4. </Block>
  5. <BlockTitle>Songs</BlockTitle>
  6. <List mediaList>
  7. <ListItem
  8. link="#"
  9. title="Yellow Submarine"
  10. after="$15"
  11. subtitle="Beatles"
  12. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  13. >
  14. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-1.jpg" width="80" />
  15. </ListItem>
  16. <ListItem
  17. link="#"
  18. title="Don't Stop Me Now"
  19. after="$22"
  20. subtitle="Queen"
  21. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  22. >
  23. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-2.jpg" width="80" />
  24. </ListItem>
  25. <ListItem
  26. link="#"
  27. title="Billie Jean"
  28. after="$16"
  29. subtitle="Michael Jackson"
  30. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  31. >
  32. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-3.jpg" width="80" />
  33. </ListItem>
  34. </List>

Mail App

  1. <BlockTitle>Mail App</BlockTitle>
  2. <List mediaList>
  3. <ListItem
  4. link="#"
  5. title="Facebook"
  6. after="17:14"
  7. subtitle="New messages from John Doe"
  8. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  9. ></ListItem>
  10. <ListItem
  11. link="#"
  12. title="John Doe (via Twitter)"
  13. after="17:11"
  14. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  15. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  16. ></ListItem>
  17. <ListItem
  18. link="#"
  19. title="Facebook"
  20. after="16:48"
  21. subtitle="New messages from John Doe"
  22. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  23. ></ListItem>
  24. <ListItem
  25. link="#"
  26. title="John Doe (via Twitter)"
  27. after="15:32"
  28. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  29. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  30. ></ListItem>
  31. </List>

Something more simple

  1. <BlockTitle>Something more simple</BlockTitle>
  2. <List mediaList>
  3. <ListItem
  4. title="Yellow Submarine"
  5. subtitle="Beatles">
  6. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-1.jpg" width="44" />
  7. </ListItem>
  8. <ListItem
  9. link="#"
  10. title="Don't Stop Me Now"
  11. subtitle="Queen">
  12. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-2.jpg" width="44" />
  13. </ListItem>
  14. <ListItem
  15. title="Billie Jean"
  16. subtitle="Michael Jackson">
  17. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-3.jpg" width="44" />
  18. </ListItem>
  19. </List>

Inset

  1. <BlockTitle>Inset</BlockTitle>
  2. <List mediaList inset>
  3. <ListItem
  4. link="#"
  5. title="Yellow Submarine"
  6. subtitle="Beatles">
  7. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-4.jpg" width="44" />
  8. </ListItem>
  9. <ListItem
  10. link="#"
  11. title="Don't Stop Me Now"
  12. subtitle="Queen">
  13. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-5.jpg" width="44" />
  14. </ListItem>
  15. <ListItem
  16. link="#"
  17. title="Billie Jean"
  18. subtitle="Michael Jackson">
  19. <img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-6.jpg" width="44" />
  20. </ListItem>
  21. </List>