react-row-select-table
simple data table react Component
Installation
npm i react-row-select-table
Usage
src
const Custom = <Table onCheck= console defaultCheckeds=13> <Thead> <Tr> <Th>id</Th> <Th>name</Th> </Tr> </Thead> <Tbody> <Tr> <Td>1</Td> <Td>tarou</Td> </Tr> <Tr> <Td>2</Td> <Td>zirou</Td> </Tr> <Tr> <Td>3</Td> <Td>subrou</Td> </Tr> </Tbody> </Table>
Props
Table
name | Type | default | Description |
---|---|---|---|
onCheck | func | Callback checked indexs Signature: function(values: Array) => void |
|
defaultCheckeds | Array | [] | default checked indexs |
Tr
name | Type | default | Description |
---|---|---|---|
isCheckRow | boolean | true | Set the check box check box to Row |
Design Customize
const Table = ` table { width: 100%; border-collapse: collapse; tr { border-bottom: 1px solid #ddd; } tr.tr-body:hover { background-color: #f5f5f5; } tr.tr-checked { background-color: #f5f5f5; } th { padding: 0.5rem; text-align: left; } td { padding: 0.5rem; text-align: left; } }` const Custom = <Table onCheck= console defaultCheckeds=13> <Thead> <Tr> <Th>id</Th> <Th>name</Th> </Tr> </Thead> <Tbody> <Tr> <Td>1</Td> <Td>tarou</Td> </Tr> <Tr> <Td>2</Td> <Td>zirou</Td> </Tr> <Tr> <Td>3</Td> <Td>subrou</Td> </Tr> </Tbody> </Table>