Skip to main content

Components

Table

Data tables display sets of data across rows and columns.

banner-Table
Square Icon

Selected Theme

Select brand or tribe name to preview style

Default

Usage

Tables are used to display tabular data using rows and columns

import { Table, TableRow, TableHead, TableCell, TableBody, HeadCell, Button, DynamicIcon } from 'legion-ui';

Variant

Legion have two variant of table

Basic Table

No.Full NameBornAgeActions
1Eric ClaptonRipley, United Kingdom77
2Adam SandlerBrooklyn, New York, United States56
3Jennifer AnistonSherman Oaks, Los Angeles, California, United States53
4Ben StillerNew York, New York, United States56
5Brooklyn DeckerDayton, Ohio, United States35
<Table>
<TableHead>
<TableRow>
<HeadCell>No.</HeadCell>
<HeadCell align="left">Full Name</HeadCell>
<HeadCell align="left">Born</HeadCell>
<HeadCell align="left">Age</HeadCell>
<HeadCell>Actions</HeadCell>
</TableRow>

Data Table

The Table component has a close mapping to the native <table> elements. This constraint makes building rich data tables challenging.

FullnameBornAge
Eric ClaptonRipley, United Kingdom77
Adam SandlerBrooklyn, New York, United States56
Jennifer AnistonSherman Oaks, Los Angeles, California, United States53
Ben StillerNew York, New York, United States56
Brooklyn DeckerDayton, Ohio, United States35
import React, { Component } from 'react';
import { DataTable as DataTableComponent } from 'legion-ui';
const dataTable = [
{
fullName: 'Eric Clapton',
born: 'Ripley, United Kingdom',
age: 77,
},

Props

Table

propertypropTyperequireddefaultdescription
aligntext--Sets or returns the alignment of a table according to surrounding text
backgroundtext--Sets or returns the background image of a table
bgColortext--Sets or returns the background color of a table
bordertext--Sets or returns the width of the table border.
captiontext--Returns the <caption> element of a table
cellPaddingtext--Sets or returns the amount of space between the cell border and cell content
cellSpacingtext--Sets or returns the amount of space between the cells in a table
heighttext--Sets or returns the height of a table
widthtext--Sets or returns the width of the table

TableRow

propertypropTyperequireddefaultdescription
aligntext--Sets or returns the horizontal alignment of the content within a table row
bgColortext--Sets or returns the background color of a table row
chtext--Sets or returns an alignment character for cells in a table row
chOfftext--Sets or returns the horizontal offset of the ch property
heighttext--Sets or returns the height of a table row.
rowIndextext--Returns the position of a row in the rows collection of a table
sectionRowIndextext--Returns the position of a row in the rows collection of a tbody, thead, or tfoot
vAligntext--Sets or returns the vertical alignment of the content within a table row

HeadCell

propertypropTyperequireddefaultdescription
abbrtext--Sets or returns the value of the abbr attribute
aligntext--Sets or returns the horizontal alignment of the content in a data cell
axistext--Sets or returns a comma-separated list of related data cells
backgroundtext--Sets or returns the background image of a data cell
bgColortext--Sets or returns the background color of a table
cellIndextext--Returns the position of a cell in the cells collection of a table row
chtext--Sets or returns an alignment character for a data cell
chOfftext--Sets or returns the horizontal offset of the ch property
colSpantext--Sets or returns the value of the colspan attribute
headerstext--Sets or returns the value of the headers attribute
heighttext--Sets or returns the height of a data cell
noWraptext--Sets or returns whether the content in a cell can be wrapped
rowSpantext--Sets or returns the value of the rowspan attribute
vAligntext--Sets or returns the vertical alignment of the content within a cell
widthtext--Sets or returns the width of a data cell

HeadCell/TableCell

propertypropTyperequireddefaultdescription
abbrtext--Sets or returns the value of the abbr attribute
aligntext--Sets or returns the horizontal alignment of the content in a data cell
axistext--Sets or returns a comma-separated list of related data cells
backgroundtext--Sets or returns the background image of a data cell
bgColortext--Sets or returns the background color of a table
cellIndextext--Returns the position of a cell in the cells collection of a table row
chtext--Sets or returns an alignment character for a data cell
chOfftext--Sets or returns the horizontal offset of the ch property
colSpantext--Sets or returns the value of the colspan attribute
headerstext--Sets or returns the value of the headers attribute
heighttext--Sets or returns the height of a data cell
noWraptext--Sets or returns whether the content in a cell can be wrapped
rowSpantext--Sets or returns the value of the rowspan attribute
vAligntext--Sets or returns the vertical alignment of the content within a cell
widthtext--Sets or returns the width of a data cell

Data Table

propertypropTypedescription
headerobjectSet the title of the expand column
itemsArray of ObjectData record array to be displayed
onFilterCategoryReact.ReactNodeFilter menu config
onSortUpReact.ReactNodesorting column
onSearchReact.ReactNodesearching list
onNestedTableReact.ReactNodenested table
searchReact.ReactNodevalue search