4.0.1 • Published 2 years ago

@paprika/sortable v4.0.1

Weekly downloads
2,281
License
MIT
Repository
github
Last release
2 years ago

@paprika/sortable

Description

Sortable component creates a vertical list of items, that can be re-ordered with a mouse via dragging and dropping, or with the keyboard

Installation

yarn add @paprika/sortable

or with npm:

npm install @paprika/sortable

Props

Sortable

PropTyperequireddefaultDescription
childrennodefalsenull
hasNumbersboolfalsetrueIndicator to identify the number sequence
hasZebraStripesboolfalsefalseAdd a background-color to all even rows
onChangefunctrue-Callback when sorting
onRemovefuncfalsenullCallback when deleting an item

SortableItem

PropTyperequireddefaultDescription
childrennodetrue-
handleElementnodefalseHandle element, default is a handle icon
hasNumbersbooltrue-Indicator to identify the number sequence
indexnumbertrue-Numerical representation of an item
isDragDisabledboolfalsefalseIf drag action should be disabled on an item
onRemovefuncfalsenullCallback when deleting an item

Usage

For the most basic case, simply provide your items as <Sortable.Item> children.

<Sortable onChange={changeHandler}>
  <Sortable.Item sortId="1">Item One</Sortable.Item>
  <Sortable.Item sortId="2">Item Two</Sortable.Item>
  <Sortable.Item sortId="3">Item Three</Sortable.Item>
</Sortable>

Children of <Sortable> that are NOT <Sortable.Item> will be ignored. A unique sortId is important to maintain the focus after an update.

When an item is moved, the onChange callback is invoked with result:

{
  source: 0,
  destination: 2,
}

If the item was dropped outside of the component, then destination will be null.

For localized screen reader descriptions, use the <L10n> provider component around this component or with your application.

Read more about the library used for this component, react-beautiful-dnd.

Links

4.0.1

2 years ago

4.0.1-next.0

2 years ago

4.0.0

2 years ago

4.0.0-next.0

2 years ago

3.0.0-next.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

3.0.1-next.0

2 years ago

2.0.3

3 years ago

2.0.3-next.0

3 years ago

2.0.2

3 years ago

2.0.2-next.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.1-next.0

3 years ago

2.0.0-next.0

3 years ago

1.2.13-next.1

3 years ago

1.2.13

3 years ago

1.2.14

3 years ago

1.2.13-next.0

3 years ago

1.2.14-next.0

3 years ago

1.2.12-next.1

3 years ago

1.2.12-next.0

3 years ago

1.2.12-next.2

3 years ago

1.2.12

3 years ago

1.2.11

4 years ago

1.2.11-next.1

4 years ago

1.2.11-next.0

4 years ago

1.2.9-next.1

4 years ago

1.2.8

4 years ago

1.2.9-next.0

4 years ago

1.2.9-next.3

4 years ago

1.2.9-next.2

4 years ago

1.2.10

4 years ago

1.2.8-next.0

4 years ago

1.2.9

4 years ago

1.2.10-next.0

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.6-next.0

4 years ago

1.2.7-next.0

4 years ago

1.2.5

4 years ago

1.2.5-next.0

4 years ago

1.2.4

4 years ago

1.2.4-next.0

4 years ago

1.2.3

4 years ago

1.2.3-next.0

4 years ago

1.2.2

4 years ago

1.2.2-next.0

4 years ago

1.2.1

4 years ago

1.2.1-next.0

4 years ago

1.2.0

4 years ago

1.2.0-next.1

4 years ago

1.2.0-next.0

4 years ago

1.1.13

4 years ago

1.1.13-next.0

4 years ago

1.1.12

4 years ago

1.1.12-next.0

4 years ago

1.1.11-next.0

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.10-next.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.8-next.1

4 years ago

1.1.8-next.0

4 years ago

1.1.9-next.0

4 years ago

1.1.7

4 years ago

1.1.7-alpha.2

4 years ago

1.1.7-alpha.1

4 years ago

1.1.7-alpha.0

4 years ago

1.1.6

4 years ago

1.1.6-alpha.0

4 years ago

1.1.5

4 years ago

1.1.5-alpha.0

4 years ago

1.1.4

4 years ago

1.1.4-alpha.0

4 years ago

1.1.3

4 years ago

1.1.3-alpha.0

4 years ago

1.1.2

5 years ago

1.1.2-alpha.0

5 years ago

1.1.1

5 years ago

1.1.1-alpha.1

5 years ago

1.1.1-alpha.0

5 years ago

1.1.0

5 years ago

1.0.2-alpha.2

5 years ago

1.0.2-alpha.1

5 years ago

1.0.1

5 years ago

1.0.2-alpha.0

5 years ago

1.0.1-alpha.1

5 years ago

1.0.1-alpha.0

5 years ago

1.0.0

5 years ago

0.2.46

5 years ago

0.2.46-alpha.4

5 years ago

0.2.46-alpha.3

5 years ago

0.2.46-alpha.2

5 years ago

0.2.46-alpha.1

5 years ago

0.2.46-alpha.0

5 years ago

0.2.45

5 years ago

0.2.44

5 years ago

0.2.43

5 years ago

0.2.42

5 years ago

0.2.41

5 years ago

0.2.40

5 years ago

0.2.39

5 years ago

0.2.38

5 years ago

0.2.37

5 years ago

0.2.36

5 years ago

0.2.35

5 years ago

0.2.34

5 years ago

0.2.33

5 years ago

0.2.32

5 years ago

0.2.31

5 years ago

0.2.30

5 years ago

0.2.29

5 years ago

0.2.28

5 years ago

0.2.27

5 years ago

0.2.26

5 years ago

0.2.25

5 years ago

0.2.24

5 years ago

0.2.23

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.19

5 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago