Props
Name | Type | Default | Description |
---|---|---|---|
sort | array | - | An array containing the children indices sorted by the order in which we want them to be rendered. |
import { Order } from 'flowr';
Order
will rearrange the children based on a specified order. The sort
prop will take an array of indices that map to the children indices. The children order will be the same as the position of their index inside the array.
If the sort
prop is not provided, the children order will remain unchanged.
A
B
C
// will render:
B
C
A
Any index that will not have a corresponding child will be ignored. Likewise, any index that is left out will result in that child not being rendered.
// sort={[1, 2, 0, 3]}
// will render:
B
C
A
// sort={[2, 0]}
// will render:
C
A
Name | Type | Default | Description |
---|---|---|---|
sort | array | - | An array containing the children indices sorted by the order in which we want them to be rendered. |
Contribute on Github! Edit this section.