Use Tables to list data in an accessible, searchable, and filterable format.
import Table from "@ds-kit/table"
Basic Table
Basic table subtitleRow 1Row 2Row 3Row 10Row 2Element #0Row 3Row 11Row 2Element #1Row 3Row 12Row 2Element #2Row 3Row 13Row 2Element #3Row 3Row 14Row 2Element #4Row 3Row 15Row 2Element #5Row 3Row 16Row 2Element #6Row 3Row 17Row 2Element #7Row 3Row 18Row 2Element #8Row 3Row 19Row 2Element #9Row 3/3<Table title="Basic Table" subtitle="Basic table subtitle" pageSize={10} chartFooter={{ sourceText: "Table footer", }} data={new Array(25).fill().map((d, i) => ({ row1: i, row2: `Element #${i}`, row3: i % 2 === 0 ? "usa" : "swe", }))} columns={[ { Header: "Row 1", accessor: "row1" }, { Header: "Row 2", accessor: "row2" }, { Header: "Row 3", accessor: "row3", Cell: props => <Flag name={props.value} />, }, ]} />
Editable Table
Row 1Row 2Row 10Row 2Element #0Row 11Row 2Element #1Row 12Row 2Element #2Row 13Row 2Element #3Row 14Row 2Element #4Row 15Row 2Element #5/5class EditableExample extends React.Component { constructor(props) { super(props) this.state = { data: new Array(25).fill().map((d, i) => ({ row1: `${i}`, row2: `Element #${i}`, })), } } render() { return ( <Table title="Editable Table" isEditable={true} pageSize={6} chartFooter={{ sourceText: "Table footer", }} updateData={newData => { // Handle new data here console.log("Data has been updated\n", newData) }} data={this.state.data} columns={[ { Header: "Row 1", accessor: "row1" }, { Header: "Row 2", accessor: "row2" }, ]} /> ) } }
Table
Table with download, disable sorting for column, enable filter, multi-sorting(press sort + 'shift' key)Row 1Row 2Row 1-6Row 2Long text word to be wrapped with Long text word to be wrapped with Long text word to be wrapped withRow 12Row 2Long text word to be wrapped withRow 1-9Row 2Long text word to be wrapped withRow 144Row 2Long text word to be wrapped withRow 198Row 2Long text word to be wrapped withRow 113Row 2Long text word to be wrapped with/2<Table title="Table" subtitle="Table with download, disable sorting for column, enable filter, multi-sorting(press sort + 'shift' key)" enableDownload={true} pageSize={6} chartFooter={{ sourceText: "Table footer", }} data={[ { row1: -6, row2: "Long text word to be wrapped with Long text word to be wrapped with Long text word to be wrapped with", }, { row1: 2, row2: "Long text word to be wrapped with" }, { row1: -9, row2: "Long text word to be wrapped with" }, { row1: 44, row2: "Long text word to be wrapped with" }, { row1: 98, row2: "Long text word to be wrapped with" }, { row1: 13, row2: "Long text word to be wrapped with" }, { row1: 13, row2: "Long text word to be wrapped with" }, { row1: -13, row2: "Long text word to be wrapped with" }, ]} columns={[ { Header: "Row 1", accessor: "row1", enableFilter: true, disableSorting: true, }, { Header: "Row 2", accessor: "row2", enableFilter: true, }, ]} />
infinite
bool
enableDownload
bool
false
isEditable
bool
false
enableSearch
bool
false
hideTableWithoutSearchString
bool
false
isBlockViewOnMobile
bool
true
pageSize
number
10
title
string
subtitle
string
fontSize
string
backgroundColor
string
"#f5f5f5"
height
string
paddingHorizontal
string
cellWidth
string
"150px"
data
array
[]
columns
array
[]
chartFooter
object
{}
updateData
func
() => {}