Sortable - 图1

Sortable React Component

Sortable is not a separate component, but just a particular case of using and components.

Sortable Events

EventDescription
<List> events
The following events will be available on <List> when sortable prop enabled
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. First handler argument contains object with from, to and el properties with start/new index numbers of sorted list item and the HTML element of sorted list item

Examples

  1. export default () => (
  2. <Page>
  3. <Navbar title="Sortable List">
  4. <NavRight>
  5. <Link sortableToggle=".sortable">Toggle</Link>
  6. </NavRight>
  7. </Navbar>
  8. <Block>
  9. <p>Just click "Toggle" button on navigation bar to enable/disable sorting</p>
  10. </Block>
  11. <List sortable>
  12. <ListItem
  13. title="1 Jenna Smith"
  14. after="CEO">
  15. <Icon icon="icon-f7" slot="media"></Icon>
  16. </ListItem>
  17. <ListItem
  18. title="2 John Doe"
  19. after="Director">
  20. <Icon icon="icon-f7" slot="media"></Icon>
  21. </ListItem>
  22. <ListItem
  23. title="3 John Doe"
  24. after="Developer">
  25. <Icon icon="icon-f7" slot="media"></Icon>
  26. </ListItem>
  27. <ListItem
  28. title="4 Aaron Darling"
  29. after="Manager">
  30. <Icon icon="icon-f7" slot="media"></Icon>
  31. </ListItem>
  32. <ListItem
  33. title="5 Calvin Johnson"
  34. after="Accounter">
  35. <Icon icon="icon-f7" slot="media"></Icon>
  36. </ListItem>
  37. <ListItem
  38. title="6 John Smith"
  39. after="SEO">
  40. <Icon icon="icon-f7" slot="media"></Icon>
  41. </ListItem>
  42. <ListItem
  43. title="7 Chloe"
  44. after="Manager">
  45. <Icon icon="icon-f7" slot="media"></Icon>
  46. </ListItem>
  47. </List>
  48. <List mediaList sortable>
  49. <ListItem
  50. title="Yellow Submarine"
  51. after="$15"
  52. subtitle="Beatles"
  53. 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."
  54. >
  55. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-1.jpg" width="80" />
  56. </ListItem>
  57. <ListItem
  58. title="Don't Stop Me Now"
  59. after="$22"
  60. subtitle="Queen"
  61. 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."
  62. >
  63. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-2.jpg" width="80" />
  64. </ListItem>
  65. <ListItem
  66. title="Billie Jean"
  67. after="$16"
  68. subtitle="Michael Jackson"
  69. 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."
  70. >
  71. <img slot="media" src="https://cdn.framework7.io/placeholder/people-160x160-3.jpg" width="80" />
  72. </ListItem>
  73. </List>
  74. <BlockTitle>Opposite Side</BlockTitle>
  75. <List sortable sortableOpposite>
  76. <ListItem
  77. title="1 Jenna Smith"
  78. after="CEO">
  79. <Icon icon="demo-list-icon" slot="media"></Icon>
  80. </ListItem>
  81. <ListItem
  82. title="2 John Doe"
  83. after="Director">
  84. <Icon icon="demo-list-icon" slot="media"></Icon>
  85. </ListItem>
  86. <ListItem
  87. title="3 John Doe"
  88. after="Developer">
  89. <Icon icon="demo-list-icon" slot="media"></Icon>
  90. </ListItem>
  91. <ListItem
  92. title="4 Aaron Darling"
  93. after="Manager">
  94. <Icon icon="demo-list-icon" slot="media"></Icon>
  95. </ListItem>
  96. <ListItem
  97. title="5 Calvin Johnson"
  98. after="Accounter">
  99. <Icon icon="demo-list-icon" slot="media"></Icon>
  100. </ListItem>
  101. <ListItem
  102. title="6 John Smith"
  103. after="SEO">
  104. <Icon icon="demo-list-icon" slot="media"></Icon>
  105. </ListItem>
  106. <ListItem
  107. title="7 Chloe"
  108. after="Manager">
  109. <Icon icon="demo-list-icon" slot="media"></Icon>
  110. </ListItem>
  111. </List>
  112. </Page>
  113. );

← Smart Select

Stepper →