data-table

v2.6.5arrow_drop_down
v2.6.5
v2.5.5
STATUS
Passing
DOWNLOADS
3,776
LICENSE
Apache 2.0
VISIBILITY
Public
PUBLISHED
3 months ago
subject
A data driven table.
1 contributor
Like
Use data-table in your project ?
Copied
npm i @bit/grommet.grommet.data-table
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
modified
modified
modified
modified
modified
chevron_left
chevron_right

DataTable

A data driven table.

Usage

import { DataTable } from 'grommet';
<DataTable />

Properties

a11yTitle

Custom title to be used by screen readers.

string

alignSelf

How to align along the cross axis when contained in a Box or along the column axis when contained in a Grid.

start
center
end
stretch

gridArea

The name of the area to place this inside a parent Grid.

string

margin

The amount of margin around the component. An object can be specified to distinguish horizontal margin, vertical margin, and margin on a particular side.

none
xxsmall
xsmall
small
medium
large
xlarge
{
  bottom: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string,
  horizontal: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string,
  left: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string,
  right: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string,
  top: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string,
  vertical: 
    xxsmall
    xsmall
    small
    medium
    large
    xlarge
    string
}
string

columns

A description of the data. The order controls the column order. ‘property’ indicates which property in the data objects to associate the column with. ‘header’ indicates what to display in the column header. ‘render’ allows for custom rendering of body cells. Use ‘render’ for custom formatting for things like currency and date or to display rich content like Meters. ‘align’ indicates how the cells in the column are aligned. ‘aggregate’ indicates how the data in the column should be aggregated. This only applies to a footer or groupBy context. ‘footer’ indicates what should be shown in the footer for the column. ‘search’ indicates whether a search filter should be made available for the column. ‘primary’ indicates that this property should be used as the unique identifier, which gives the cell ‘row’ scope for accessibility. If ‘primary’ is not used for any column, and ‘primaryKey’ isn’t specified either, then the first column will be used. Defaults to [].

[{
  align: 
    center
    start
    end,
  aggregate: 
    avg
    max
    min
    sum,
  footer: 
    node
    {
      aggregate: boolean
    },
  header: 
    string
    node
    {
      aggregate: boolean
    },
  primary: boolean,
  property: string,
  render: function,
  search: boolean,
  sortable: boolean
}]

data

Array of data objects. Defaults to [].

[{

}]

groupBy

Property to group data by.

string

onMore

Use this to indicate that ‘data’ doesn’t contain all that it could. It will be called when all of the data rows have been rendered. This might be used when the total number of items that could be retrieved is more than you’d want to load into the browser. ‘onMore’ allows you to lazily fetch more from the server only when needed. This cannot be combined with properties that expect all data to be present in the browser, such as columns.search, sortable, groupBy, or columns.aggregate.

function

onSearch

When supplied, and when at least one column has ‘search’ enabled, this function will be called with an object with keys for property names and values which are the search text strings. This is typically employed so a back-end can be used to search through the data.

function

primaryKey

When supplied, indicates the property for a data object to use to get a unique identifier. See also the ‘columns.primary’ description. Use this property when the columns approach will not work for your data set.

string

resizeable

Whether to allow the user to resize column widths.

boolean

size

The height of the table body. If set, the table body will have a fixed height and the rows will be scrollable within it. In order to preserve header and footer cell alignment, all cells will have the same width. This cannot be used in combination with 'resizeable’.

small
medium
large
xlarge
string

sortable

Whether to allow the user to sort columns.

boolean

Intrinsic element

table