Items
Add and remove items
To add
orremove
Items the MuuriComponent just have to be re-rendered with different children.
As you will see in the example below, it is good practice to store the Items data in the component state
, modifyng this state will allow us to add or remove the Items we want.
It's possible to both
remove and add Items in a single re-render.
Add in position ๐
The new Items will be added in the same position
in which they have been added in the children array.
info
If a sort is used, it will have priority over choosing the position of the added items.
Visibility ๐
An Item can be added as visible
or hidden
based on the CSS display property which can be block or none. By default all added Items are shown, to change this you need to edit the addOptions property.
info
If a filter is used, it will have priority over choosing to show/hide items.
Style features ๐
- It's possible to control the gaps between the Items by giving some
margin
to the Items (outer) elements. - It's possible to see the
showing animations
when an Item is added by setting the CSS display property of the Item (outer) element tonone
.