List Item React Component
List Item Components
There are following components included:
**ListItem**
/**F7ListItem**
- main list item element**ListItemRow**
/**F7ListItemRow**
- list item row element for custom layout**ListItemCell**
/**F7ListItemCell**
- list item cell element for custom layout
List Item Properties
Prop | Type | Default | Description |
---|---|---|---|
<ListItem> properties | |||
title | string | List item title | |
subtitle | string | List item subtitle (only for Media List) | |
text | string | List item text (only for Media List) | |
header | string | List item header text | |
footer | string | List item footer text | |
media | string | List item media image URL | |
after | string | List item label | |
badge | string number | List item Badge | |
badgeColor | string | List item Badge color. One of the default colors | |
mediaItem | boolean | Enables Media list item for the current list item | |
divider | boolean | Converts list item to list item divider | |
groupTitle | boolean | Converts list item to list group title | |
noFastClick | boolean | Disables fast click | |
target | boolean | List item link target attribute | |
noChevron | boolean | false | Removes “chevron” icon on list item link |
chevronCenter | boolean | false | Sets “chevron” icon on media list item on center (vertically) |
tooltip | string | List button tooltip text to show on button hover/press | |
<ListItem> Form inputs specific properties | |||
inlineLabel | boolean | false | Enables inline-styled labels for Form Inputs. By default inherirt inlineLabels prop on parent <List> |
itemInput | boolean | false | Enables additional styling for Form Inputs inside. By default will try to detect based on content |
itemInputWithInfo | boolean | false | Enables additional styling for Form Inputs with additional info. By default will try to detect based on content |
<ListItem> Swipeout specific properties | |||
swipeout | boolean | Converts list item to swipeout list item | |
swipeoutOpened | boolean | Defines whether swipe actions should be opened or not. Note, only one swipeout item can be opened at same time | |
<ListItem> Accordion specific properties | |||
accordionItem | boolean | false | Converts list item to accordion list item |
accordionItemOpened | boolean | false | Makes accordion item opened |
<ListItem> Sortable List specific properties | |||
sortable | boolean | Allows to disable (when false ) sorting of specific list item. Note, that it makes sense and work only on first or last items in the list and won’t work correctly if you disable sortable for some of the items in the middle. | |
<ListItem> Virtual List specific properties | |||
virtualListIndex | number | Allows to pass list item index (from whole collection) when used in Virtual List. Useful to be used together with Sortable to know correct changed indexes | |
<ListItem> Smart Select specific properties | |||
smartSelect | boolean | false | Enables Smart Select behavior |
smartSelectParams | object | Object with Smart Select Parameters | |
<ListItem> Checkboxes & Radios specific properties | |||
checkbox | boolean | false | Enables checkbox-item |
radio | boolean | false | Enables radio-item |
checked | boolean | false | Whether the checkbox/radio input is checked |
defaultChecked | boolean | Defines whether the checkbox input is checked or not, for the case if it is uncontrolled component | |
indeterminate | boolean | Defines whether the checkbox input is in indeterminate state or not | |
name | string | Checkbox/radio input name | |
value | string number | Checkbox/radio input value | |
readonly | boolean | false | Whether the checkbox/radio input is readonly |
disabled | boolean | false | Whether the checkbox/radio input is disabled |
required | boolean | false | Whether the checkbox/radio input is required |
<ListItem> navigation/router related properties | |||
link | boolean string | Enables link and link URL if specified as string. Same as href prop | |
href | string boolean | # | URL of the page to load. In case of boolean href=”false” it won’t add href tag |
target | string | Value of link target attribute, e.g. _blank , _self , etc. | |
view | string | CSS selector of the View to load the page | |
external | boolean | Enable to bypass Framework7’s link click handler | |
back | boolean | Enables back navigation link | |
force | boolean | Force page to load and ignore previous page in history (use together with back prop) | |
reloadCurrent | boolean | Reloads new page instead of the currently active one | |
reloadPrevious | boolean | Replace the previous page in history with the new one from route | |
reloadAll | boolean | Load new page and remove all previous pages from history and DOM | |
reloadDetail | boolean | Reload Detail page in Master Detail view | |
animate | boolean | Disables pages animation | |
ignoreCache | boolean | Ignores caching | |
routeTabId | string | Routable Tab id | |
routeProps | object | Object with additional props that will be passed to target route component | |
preventRouter | boolean | false | If set, then it won’t be processed by Framework7 router |
<ListItem> action related properties | |||
panelOpen | string boolean | Defines panel to open. Can be left or right | |
panelClose | boolean | Closes panel on click | |
panelToggle | boolean | Toggle (open/close) panel on click | |
actionsOpen | string boolean | CSS selector of the action sheet to open on click | |
actionsClose | string boolean | CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet | |
popupOpen | string boolean | CSS selector of the popup to open on click | |
popupClose | string boolean | CSS selector of the popup to close on click. Or boolean property to close currently opened popup | |
popoverOpen | string boolean | CSS selector of the popover to open on click | |
popoverClose | string boolean | CSS selector of the popover to close on click. Or boolean property to close currently opened popover | |
sheetOpen | string boolean | CSS selector of the sheet modal to open on click | |
sheetClose | string boolean | CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal | |
loginScreenOpen | string boolean | CSS selector of the login screen to open on click | |
loginScreenClose | string boolean | CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen | |
sortableEnable | string boolean | CSS selector of the Sortable list to open on click | |
sortableDisable | string boolean | CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list | |
sortableToggle | string boolean | CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list | |
searchbarEnable | string boolean | CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar | |
searchbarDisable | string boolean | CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar | |
searchbarToggle | string boolean | CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar | |
searchbarClear | string boolean | CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar | |
cardOpen | string boolean | CSS selector of the expandable card to open on click. Or boolean to open first found expandable card | |
cardClose | string boolean | CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card | |
cardPreventOpen | boolean | Click on element with this prop won’t open its parent expandable card | |
menuClose | boolean | Closes Menu dropdown on click |
List Item Events
Event | Description |
---|---|
<ListItem> events | |
click | Event will be triggeres when user clicks on list item |
change | Event will be triggeres when “change” event occurs on list item input (radio or checkbox) |
swipeout | Event will be triggered while you move swipeout element. event.detail.progress contains current opened progress percentage |
swipeoutOpen | Event will be triggered when swipeout element starts its opening animation |
swipeoutOpened | Event will be triggered after swipeout element completes its opening animation |
swipeoutClose | Event will be triggered when swipeout element starts its closing animation |
swipeoutClosed | Event will be triggered after swipeout element completes its closing animation |
swipeoutDelete | Event will be triggered after swipeout element starts its delete animation |
swipeoutDeleted | Event will be triggered after swipeout element completes its delete animation right before it will be removed from DOM |
accordionBeforeOpen | Event will be triggered right before accordion content starts its opening animation. event.detail.prevent contains function that will prevent accordion from opening when called |
accordionOpen | Event will be triggered when accordion content starts its opening animation. |
accordionOpened | Event will be triggered after accordion content completes its opening animation. |
accordionBeforeClose | Event will be triggered right before accordion content starts its closing animation. event.detail.prevent contains function that will prevent accordion from closing when called |
accordionClose | Event will be triggered when accordion content starts its closing animation. |
accordionClosed | Event will be triggered after accordion content completes its closing animation. |
List Item Slots
List Item React component (<ListItem>
) has additional slots for custom elements:
**root-start**
- element will be inserted in the beginning of<li>
element**root**
/**root-end**
- element will be inserted in the end of<li>
element**content-start**
- element will be inserted in the beginning of<div class="item-content">
element**content**
/**content-end**
- element will be inserted in the end of<div class="item-content">
element**inner-start**
- element will be inserted in the beginning of<div class="item-inner">
element**default**
/**inner**
/**inner-end**
- element will be inserted in the end of<div class="item-inner">
element**media**
- element will be inserted inside of<div class="item-media">
element**before-title**
- element will be inserted before<div class="item-title">
element**title**
- element will be inserted inside of<div class="item-title">
element**after-title**
- element will be inserted after<div class="item-title">
element**subtitle**
- element will be inserted inside of<div class="item-subtitle">
element**text**
- element will be inserted inside of<div class="item-text">
element**header**
- element will be inserted inside of<div class="item-header">
element**footer**
- element will be inserted inside of<div class="item-footer">
element**after-start**
- element will be inserted in the beginning of<div class="item-after">
element**after**
/**after-end**
- element will be inserted in the end of<div class="item-after">
element
<List media-list>
<ListItem
link="/home/"
title="Item Title"
subtitle="Item Subtitle"
text="Text"
after="Read more"
>
<img src="path-to-my-image.jpg" slot="media">
<div slot="root-start">Root Start</div>
<div slot="root">Root End</div>
<div slot="content-start">Content Start</div>
<div slot="content">Content End</div>
<div slot="media-start">Media Start</div>
<div slot="media">Media</div>
<span slot="after-start">After Start</span>
<span slot="after">After End</span>
<div slot="inner-start">Inner Start</div>
<div slot="inner">Inner End</div>
<div slot="before-title">Before Title</div>
<div slot="after-title">After Title</div>
</ListItem>
</List>
{/* Renders to: */}
<div class="list media-list">
<ul>
<li>
<div>Root Start</div>
<a href="/home/" class="item-link">
<div class="item-content">
<div>Content Start</div>
<div class="item-media">
<img src="path-to-my-image.jpg">
</div>
<div class="item-inner">
<div>Inner Start</div>
<div class="item-title-row">
<div>Before Title</div>
<div class="item-title">Item Title</div>
<div>After Title</div>
<div class="item-after">
<span>After Start</span>
<span>Read more</span>
<span>After End</span>
</div>
</div>
<div class="item-subtitle">Item Subtitle</div>
<div class="item-text">Text</div>
<div>Inner End</div>
</div>
<div>Content End</div>
</div>
</a>
<div>Root End</div>
</li>
</ul>
</div>
Examples
Simple List
<BlockTitle>Simple List</BlockTitle>
<List simple-list>
<ListItem title="Item 1"></ListItem>
<ListItem title="Item 2"></ListItem>
<ListItem title="Item 3"></ListItem>
</List>
Simple List Links
<BlockTitle>Simple Links List</BlockTitle>
<List>
<ListItem title="Link 1" link="#"></ListItem>
<ListItem title="Link 2" link="#"></ListItem>
<ListItem title="Link 3" link="#"></ListItem>
</List>
Data list, with icons
<BlockTitle>Data list, with icons</BlockTitle>
<List>
<ListItem title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="John Doe" badge="5">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="Jenna Smith">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
</List>
Links
<BlockTitle>Links</BlockTitle>
<List>
<ListItem link="#" title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="John Doe" after="Cleaner">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Jenna Smith">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
</List>
Links, Header, Footer
<BlockTitle>Links, Header, Footer</BlockTitle>
<List>
<ListItem link="#" header="Name" title="John Doe" after="Edit">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" header="Phone" title="+7 90 111-22-3344" after="Edit">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" header="Email" title="john@doe" footer="Home" after="Edit">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" header="Email" title="john@framework7" footer="Work" after="Edit">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
</List>
Links, no icons
<BlockTitle>Links, no icons</BlockTitle>
<List>
<ListItem link="#" title="Ivan Petrov"></ListItem>
<ListItem link="#" title="John Doe"></ListItem>
<ListItem divider title="Divider Here"></ListItem>
<ListItem link="#" title="Ivan Petrov"></ListItem>
<ListItem link="#" title="Jenna Smith"></ListItem>
</List>
Grouped with sticky titles
<BlockTitle>Grouped with sticky titles</BlockTitle>
<List>
<ListGroup>
<ListItem title="A" groupTitle></ListItem>
<ListItem title="Aaron "></ListItem>
<ListItem title="Abbie"></ListItem>
<ListItem title="Adam"></ListItem>
</ListGroup>
<ListGroup>
<ListItem title="B" groupTitle></ListItem>
<ListItem title="Bailey"></ListItem>
<ListItem title="Barclay"></ListItem>
<ListItem title="Bartolo"></ListItem>
</ListGroup>
<ListGroup>
<ListItem title="C" groupTitle></ListItem>
<ListItem title="Caiden"></ListItem>
<ListItem title="Calvin"></ListItem>
<ListItem title="Candy"></ListItem>
</ListGroup>
</List>
Mixed and nested
<BlockTitle>Mixed and nested</BlockTitle>
<List>
<ListItem link="#" title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Two icons here">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="No icons here"></ListItem>
<li>
<ul>
<ListItem link="#" title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Two icons here">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="No icons here"></ListItem>
<ListItem link="#" title="Ultra long text goes here, no, it is really really long">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="With toggle">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Toggle slot="after"></Toggle>
</ListItem>
</ul>
</li>
<ListItem link="#" title="Ultra long text goes here, no, it is really really long">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="With toggle">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Toggle slot="after"></Toggle>
</ListItem>
</List>
Mixed, inset
<BlockTitle>Mixed, inset</BlockTitle>
<List>
<ListItem link="#" title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Two icons here">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Ultra long text goes here, no, it is really really long">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem title="With toggle">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Toggle slot="after"></Toggle>
</ListItem>
<BlockFooter>
<p>Here comes some useful information about list above</p>
</BlockFooter>
</List>
Tablet inset
<BlockTitle>Tablet inset</BlockTitle>
<List tabletInset>
<ListItem link="#" title="Ivan Petrov" after="CEO">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Two icons here">
<Icon slot="media" icon="demo-list-icon"></Icon>
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<ListItem link="#" title="Ultra long text goes here, no, it is really really long">
<Icon slot="media" icon="demo-list-icon"></Icon>
</ListItem>
<BlockFooter>
<p>This list block will look like "inset" only on tablets (iPad)</p>
</BlockFooter>
</List>
Media Lists
<BlockTitle>Media Lists</BlockTitle>
<Block>
<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>
</Block>
<BlockTitle>Songs</BlockTitle>
<List mediaList>
<ListItem
link="#"
title="Yellow Submarine"
after="$15"
subtitle="Beatles"
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."
>
<img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-1.jpg" width="80" />
</ListItem>
<ListItem
link="#"
title="Don't Stop Me Now"
after="$22"
subtitle="Queen"
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."
>
<img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-2.jpg" width="80" />
</ListItem>
<ListItem
link="#"
title="Billie Jean"
after="$16"
subtitle="Michael Jackson"
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."
>
<img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-3.jpg" width="80" />
</ListItem>
</List>
Mail App
<BlockTitle>Mail App</BlockTitle>
<List mediaList>
<ListItem
link="#"
title="Facebook"
after="17:14"
subtitle="New messages from John Doe"
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."
></ListItem>
<ListItem
link="#"
title="John Doe (via Twitter)"
after="17:11"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
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."
></ListItem>
<ListItem
link="#"
title="Facebook"
after="16:48"
subtitle="New messages from John Doe"
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."
></ListItem>
<ListItem
link="#"
title="John Doe (via Twitter)"
after="15:32"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
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."
></ListItem>
</List>
Something more simple
<BlockTitle>Something more simple</BlockTitle>
<List mediaList>
<ListItem
title="Yellow Submarine"
subtitle="Beatles">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-1.jpg" width="44" />
</ListItem>
<ListItem
link="#"
title="Don't Stop Me Now"
subtitle="Queen">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-2.jpg" width="44" />
</ListItem>
<ListItem
title="Billie Jean"
subtitle="Michael Jackson">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-3.jpg" width="44" />
</ListItem>
</List>
Inset
<BlockTitle>Inset</BlockTitle>
<List mediaList inset>
<ListItem
link="#"
title="Yellow Submarine"
subtitle="Beatles">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-4.jpg" width="44" />
</ListItem>
<ListItem
link="#"
title="Don't Stop Me Now"
subtitle="Queen">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-5.jpg" width="44" />
</ListItem>
<ListItem
link="#"
title="Billie Jean"
subtitle="Michael Jackson">
<img slot="media" src="https://cdn.framework7.io/placeholder/fashion-88x88-6.jpg" width="44" />
</ListItem>
</List>
当前内容版权归 Framework7 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Framework7 .