boolean
true
false
string
"property"
Using Grommet for HPE?See DataTable examples and guidance.
string
"a user friendly label for screen readers"
string
"start"
"center"
"end"
"stretch"
"baseline"
onSelect
is defined.boolean
true
false
string
"light-2"
array
["white", "light-2"]
object
{ header: "dark-2", body: ["white", "light-2"], footer: { dark: "light-2", light: "dark-3" } }
boolean
true
false
string
"horizontal"
"vertical"
"top"
"bottom"
"right"
"left"
object
{ color: "border", side: "horizontal", size: "small" }
{ header: "bottom", body: { color: "light-2", side: "bottom" }, footer: "top" }
array
[ { align: "...", aggregate: "...", footer: node | { aggregate: "..." }, header: string | node | { aggregate: "..." }, pin: boolean, plain: boolean, primary: boolean, property: "string", render: function, search: boolean, sortable: boolean, size: "...", units: "string", verticalAlign: "..." } ]
"start"
"center"
"end"
"avg"
"max"
"min"
"sum"
"small"
"medium"
"large"
"xlarge"
"1/2"
"1/4"
"2/4"
"3/4"
"1/3"
"2/3"
"string"
"middle"
"top"
"bottom"
array
["string"]
[number]
string
"horizontal"
"vertical"
boolean
true
false
string
"location"
object
{ "property": "location", "expand": ["Paris", "Los Angeles"], "onExpand": "(key) => {...}" }
{ "property": "location", "expand": ["Paris", "Los Angeles"], "expandable": ["Paris", "Los Angeles", "Fort Collins", "San Jose"], "select": { "": "some", "Paris": "all", "Los Angeles": "some"} "onSelect": (selected, datum, groupBySelected) => {...} }
string
"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object
{ vertical: "...", horizontal: "...", top: "...", bottom: "...", left: "...", right: "..." }
select
to onClickRow.function
({ datum }) => {...}
string
'select'
function
() => {}
function
({ key: "search text", ... }) => {...}
function
This function will be called with an array of primary key values, suitable to be passed to the 'select' property, along with the data item that was changed. If you are storing select state via a 'useState' hook, you can do something like: ' <DataTable select={select} onSelect={setSelect} />'.
(selected, datum) => {}
When supplied, this function will be called with an object with a 'property' property that indicates which property is being sorted on and a 'direction' property that will either be 'asc' or 'desc'.
function
({ property, direction }) => {}
This function provides a way to lazy-load data. It is similar to `onMore` except it also allows for lazily providing expanded group data and assumes the `data` is already in sorted order. Like `onMore`, DataTable will call `onUpdate` when the user has scrolled to the end of existing data. `onUpdate` is also called when the sort changes or a group is expanded or collapsed by the user. It is passed information on the current sort settings and the maximum number of items it needs to return. If `groupBy` is specified, `data` should include an item for each group also. This item should have its own unique value in the property specified as the `primaryKey` and this unique key value should be listed in `groupBy.expandable` so the DataTable can tell it is a group header. `onUpdate` will be passed an array of group keys for groups that are currently expanded so it can decide whether to include items for a group's members. If the table also has `select` or `onSelect` specified, `groupBy` should also include an `onSelect` callback and a separate `select` to define the overall selection state of the groups. Since DataTable may not have all the items, it is up to the onSelect callbacks and onUpdate to determine if groups are fully or partially selected and set that in `groupBy.select`.
function
({ expanded, sort, show, count }) => {}
string
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"any CSS size"
object
{ vertical: "...", horizontal: "...", top: "...", bottom: "...", left: "...", right: "...", start: "...", end: "..." }
{ header: "...", body: "...", footer: "..." }
boolean
true
false
object
{}
boolean
true
false
string
"header"
"footer"
string
"loading..."
node
<Box>...</Box>
boolean
true
false
string
"property"
boolean
true
false
function
() => {}
Row specific background, border, and pad, keyed by primary key value. The background, border, and pad accept the same values as the same named properties on DataTable.
object
{ "primary-key-value": { background: ..., border: ..., pad: ... }}
array
["string"]
[number]
number
10
object
{ page: 2 }
string
"small"
"medium"
"large"
"xlarge"
"string"
object
{ direction: "asc" | "desc", external: boolean, property: "string" }
At its core, the DataTable component is a regular <table> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for table elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.
string
"active"
object
{ color: 'active', opacity: 'medium' }
string
"black"
object
{ dark: 'white', light: 'black' }
string
css`color: 'blue'`
function
(props) => {}
object
{ gap: 'small' }
string
css`color: 'blue'`
function
(props) => {}
string
"light-2"
object
{ dark: 'dark-2', light: 'light-2' }
string
"small"
object
{ horizontal: "small", vertical: "xsmall" }
object
{ gap: "small", units: { color: "text-xweak", margin: { left: "xsmall" } } }
string
"background"
object
{ dark: string, light: string }
{ color: { dark: string, light: string } | string, dark: bool, image: string, position: string, opacity: bool | string, repeat: no-repeat | repeat, size: cover | contain | string }
string
"bottom"
object
{ color: string | { dark: string, light: string }, size: "medium", style: "dashed", side: "all" }
string
"brand"
object
{ dark: "string", light: "string" }
string
css`color: 'blue'`
function
(props) => {}
string
"background"
object
{ dark: string, light: string }
{ color: { dark: string, light: string } | string, dark: bool, image: string, position: string, opacity: bool | string, repeat: no-repeat | repeat, size: cover | contain | string }
string
"small"
object
{ horizontal: "small", vertical: "xsmall" }
object
{ color: "text-xweak", margin: { left: "xsmall" } }
string
"brand"
object
{ dark: "string", light: "string" }
string
"end"
string
"2px"
string
"background"
object
{ dark: string, light: string }
{ color: { dark: string, light: string } | string, dark: bool, image: string, position: string, opacity: bool | string, repeat: no-repeat | repeat, size: cover | contain | string }
string
css`color: 'blue'`
function
(props) => {}
string
"background"
object
{ dark: string, light: string }
{ color: { dark: string, light: string } | string, dark: bool, image: string, position: string, opacity: bool | string, repeat: no-repeat | repeat, size: cover | contain | string }
string
css`color: 'blue'`
function
(props) => {}
string
"border"
object
{ dark: "string", light: "string" }
string
"brand"
object
{ dark: "string", light: "string" }