Swipeout React Component

    Swipeout List is not a separate component, but just a particular case of using <List>, <ListItem swipeout> React components and additional Swipeout components.

    Swipeout React component represents Framework7's Swipeout component.

    Swipeout Components

    There are following components included:

    • SwipeoutActions / F7SwipeoutActions - wrapper for swipeout buttons
    • SwipeoutButton / F7SwipeoutButton - single swipeout button

    Swipeout Properties

    Prop Type Default Description
    <SwipeoutActions> Properties
    side string right Swipeout actions side
    right boolean Shortcut for side="right" prop
    left boolean Shortcut for side="right" prop
    <SwipeoutButton> Properties
    delete boolean false Will automatically delete swipeout list item on click
    close boolean false Will automatically close swipeout list item on click
    overswipe boolean false Will be triggered click automatically if you swipe actions too much - overswipe
    text string Swipeout button text label
    confirmText string This text will be shown in dialog where user must agree before item delete

    Swipeout Events

    Event Description
    <SwipeoutButton> events
    click Event will be triggered on swipeout button click
    <ListItem> events
    The following events will be available on <ListItem> with swipeout enabled
    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

    Examples

    export default class extends React.Component {
      constructor(props) {
        super(props);
      }
      more() {
        const self = this;
        self.actions.open();
      }
      mark() {
        const app = this.$f7;
        app.dialog.alert('Mark');
      }
      reply() {
        const app = this.$f7;
        app.dialog.alert('Reply');
      }
      forward() {
        const app = this.$f7;
        app.dialog.alert('Forward');
      }
      onDeleted() {
        const app = this.$f7;
        app.dialog.alert('Thanks, item removed!');
      }
      onPageBeforeRemove() {
        const self = this;
        self.actions.destroy();
      }
      onPageInit() {
        const self = this;
        const app = self.$f7;
        self.actions = app.actions.create({
          buttons: [
            [
              {
                text: 'Here comes some optional description or warning for actions below',
                label: true,
              },
              {
                text: 'Action 1',
              },
              {
                text: 'Action 2',
              },
            ],
            [
              {
                text: 'Cancel',
                bold: true,
              },
            ],
          ],
        });
      }
      render () {
        return (
          <Page onPageBeforeRemove={this.onPageBeforeRemove.bind(this)} onPageInit={this.onPageInit.bind(this)}>
            <Navbar title="Swipeout"></Navbar>
    
            <Block>
              <p>
                Swipe out actions on list elements is one of the most awesome F7 features. It allows you to call hidden menu for each list element where you can put default ready-to use delete button or any other buttons for some required actions.
              </p>
            </Block>
    
            <BlockTitle>Swipe to delete with confirm modal</BlockTitle>
            <List>
              <ListItem
                swipeout
                title="Swipe left on me please">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                title="Swipe left on me too">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                title="I am not removable">
    
              </ListItem>
            </List>
    
            <BlockTitle>Swipe to delete without confirm</BlockTitle>
            <List>
              <ListItem
                swipeout
                title="Swipe left on me please">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                title="Swipe left on me too">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                title="I am not removable">
              </ListItem>
            </List>
    
            <BlockTitle>Swipe for actions</BlockTitle>
            <List>
              <ListItem
                swipeout
                title="Swipe left on me please">
    
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                title="Swipe left on me too">
    
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                title="You can't delete me">
    
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
            </List>
    
            <BlockTitle>With callback on remove</BlockTitle>
            <List>
              <ListItem
                swipeout
                onSwipeoutDeleted={this.onDeleted.bind(this)}
                title="Swipe left on me please">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                onSwipeoutDeleted={this.onDeleted.bind(this)}
                title="Swipe left on me too">
    
                <SwipeoutActions right>
                  <SwipeoutButton delete>Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                title="I am not removable">
    
              </ListItem>
            </List>
    
            <BlockTitle>With actions on left side (swipe to right)</BlockTitle>
            <List>
              <ListItem
                swipeout
                title="Swipe right on me please">
    
                <SwipeoutActions left>
                  <SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                title="Swipe right on me too">
    
                <SwipeoutActions left>
                  <SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
            </List>
    
            <BlockTitle>On both sides with overswipes</BlockTitle>
            <List mediaList>
              <ListItem
                swipeout
                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."
              >
                <SwipeoutActions left>
                  <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                  <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                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."
              >
                <SwipeoutActions left>
                  <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                  <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                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."
              >
                <SwipeoutActions left>
                  <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                  <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
              <ListItem
                swipeout
                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."
              >
                <SwipeoutActions left>
                  <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                  <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                </SwipeoutActions>
                <SwipeoutActions right>
                  <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                  <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                  <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                </SwipeoutActions>
              </ListItem>
            </List>
          </Page>
        );
      }
    };