|
Download wp-calypso/client/my-sites/store/components/table/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/store/components/table/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/store/components/table/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/store/components/table/README.md
2.08 kB
Table
Table is a component used to display tabular data. It is used to render semantic HTML table markup while handling accessibility. More information on accessible tables here.
The compact prop applies styling for a more compact table. It also allows for a column to occupy the largest space available by including the prop isTitle on a TableItem. Contents of the cell will have overflow faded to white.
How to use
import Table from './components/table';
import TableItem from './components/table/table-item';
import TableRow from './components/table/table-row';
function render() {
const titles = (
<TableRow isHeader>
{ [ 'One', 'Two', 'Three' ].map( ( item, i ) => (
<TableItem isHeader key={ i } isTitle={ 0 === i }>
{ item }
</TableItem>
) ) }
</TableRow>
);
const values = [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ],
];
return (
<Table header={ titles } compact>
{ values.map( ( row, i ) => (
<TableRow key={ i }>
{ row.map( ( item, j ) => (
<TableItem key={ j } isTitle={ 0 === j }>
{ item }
</TableItem>
) ) }
</TableRow>
) ) }
</Table>
);
}
Props <Table/>
header: A<TableRow />element used to define the table's head.className: Classes added to top level element.compact: Denotes a more compact table.
Props <TableRow/>
className: Classes added to top level element.isHeader: Establishes row as being used for table head.href: Optional link, if set, the row becomes clickable/focusable.
Props <TableItem/>
alignRight: Applytext-align: righton an item.className: Classes added to top level element.isHeader: Establishes item as being a column header.isRowHeader: Establishes item as being a row header.isTitle: Used to specify a main cell occupying the maximum available space incompactmode.
