ValentinH / react-easy-sort

A React component to sort items in lists or grids
https://ValentinH.github.io/react-easy-sort
MIT License
160 stars 25 forks source link

Enable customizing html tag for container element #18

Closed gtluszcz closed 3 years ago

gtluszcz commented 3 years ago

Hi! Lately, we have wanted to use react-easy-sort inside <p> element. Quickly we found out that component SortableItems uses <div> under the hood. As it's widely known div cannot appear as a descendant of p. Together with my coworker, we figured out it would be awesome to be able to customize the HTML tag for the container component.

valid usecases include:

This PR introduces breaking change. You need to provide new prop as

Edit: The as prop is now optional and defaults to div

ValentinH commented 3 years ago

Thanks for this contribution. I'm fine with this change, however I'd make this new prop optional and default it to div to avoid the breaking change.

ValentinH commented 3 years ago

This was published under https://github.com/ricardo-ch/react-easy-sort/releases/tag/v1.3.0