Back to Woocommerce

README

packages/js/components/src/list-item/README.md

10.8.0-dev817 B
Original Source

ListItem

This component adds basic styles to list items and handles adding a handle when inside a Sortable container.

Usage

You can use this list item directly and add your child content inside.

jsx
<ListItem>
    Your content
</ListItem>

Or you can add this inside a sortable container to automatically add handles.

jsx
<Sortable>
    <ListItem>Item 1 with handle</ListItem>
    <ListItem>Item 2 with handle</ListItem>
</Sortable>

Props

NameTypeDefaultDescription
childrenJSX.Element | JSX.Element[] | stringundefinedThe content to show inside the list item
onDragEndFunction() => nullA callback when an item is no longer being dragged
onDragStartFunction() => nullA callback when an item starts being dragged