Midas table components and styles for TanStack Table
npm install @midas-ds/table-stylesReact components and styles for TanStack Table with Midas design system.
``bash`
npm install @midas-ds/table-styles @tanstack/react-table
`typescript`
import { Pagination } from '@midas-ds/table-styles'
import '@midas-ds/table-styles/tanstack-table.css'
`typescript
import { useReactTable, getCoreRowModel, getPaginationRowModel } from '@tanstack/react-table'
import { Pagination } from '@midas-ds/table-styles'
import '@midas-ds/table-styles/tanstack-table.css'
function MyTable() {
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
})
const { pagination: { pageIndex, pageSize } } = table.getState()
return (
<>
getCanPreviousPage={table.getCanPreviousPage}
getPageCount={table.getPageCount}
getRowCount={table.getRowCount}
nextPage={table.nextPage}
pageIndex={pageIndex}
pageSize={pageSize}
previousPage={table.previousPage}
setPageIndex={table.setPageIndex}
setPageSize={table.setPageSize}
/>
>
)
}
``
For complete documentation and examples, visit Midas Design System