unclecheese / react-selectable

A component for react that allows mouse selection of child items
MIT License
142 stars 72 forks source link

Can it be used with tables? #60

Open matveychuk opened 5 years ago

matveychuk commented 5 years ago

I want to use this library to select rows in the table for further actions. I can describe component type for SelectableGroup, for example, tbody. But I can't set component type for SelectableComponent, it's always div. So I have error <tr> cannot appear as a child of <div>. Is there any way to handle it?

IrisCZ commented 4 years ago

Hi! Maybe it's a little bit late for you to solve this but what I've done is to include the SelectableComponent in a td. The code would be ended something like this:

<td>
     <SelectableComponent
            available={ available }
            onChange={() => {}}
            selectableKey={ key }
      >
           {text}
       </SelectableComponent>
</td>