|
| 1 | +--- |
| 2 | +name: "Table" |
| 3 | +title: Table |
| 4 | +published: true |
| 5 | +component: table |
| 6 | +description: A table is used to organize and display structured data in rows and columns. |
| 7 | +--- |
| 8 | + |
| 9 | +import { |
| 10 | + Table, |
| 11 | + TableBody, |
| 12 | + TableCell, |
| 13 | + TableContainer, |
| 14 | + TableHead, |
| 15 | + TableRow |
| 16 | +} from "@sistent/sistent" |
| 17 | + |
| 18 | +Tables are used to present structured data in a clear and organized way. They help users scan information quickly, compare values, and understand relationships between data. |
| 19 | + |
| 20 | +## Overview |
| 21 | + |
| 22 | +Tables help organize data into rows and columns, making it easier to read and analyze information. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +Tables should be used when: |
| 29 | + |
| 30 | +- Displaying structured data |
| 31 | +- Comparing values |
| 32 | +- Showing logs or metrics |
| 33 | +- Listing users or resources |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Examples |
| 38 | + |
| 39 | +### Basic Table |
| 40 | + |
| 41 | +Basic tables are used to display structured data in rows and columns. |
| 42 | + |
| 43 | +<TableContainer> |
| 44 | + <Table> |
| 45 | + <TableHead> |
| 46 | + <TableRow> |
| 47 | + <TableCell>Name</TableCell> |
| 48 | + <TableCell>Role</TableCell> |
| 49 | + <TableCell>Status</TableCell> |
| 50 | + </TableRow> |
| 51 | + </TableHead> |
| 52 | + <TableBody> |
| 53 | + <TableRow> |
| 54 | + <TableCell>User 1</TableCell> |
| 55 | + <TableCell>Contributor</TableCell> |
| 56 | + <TableCell>Active</TableCell> |
| 57 | + </TableRow> |
| 58 | + </TableBody> |
| 59 | + </Table> |
| 60 | +</TableContainer> |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +### Striped Table |
| 65 | + |
| 66 | +Striped tables improve readability by alternating row colors. |
| 67 | + |
| 68 | +<TableContainer> |
| 69 | + <Table striped> |
| 70 | + <TableHead> |
| 71 | + <TableRow> |
| 72 | + <TableCell>Name</TableCell> |
| 73 | + <TableCell>Role</TableCell> |
| 74 | + </TableRow> |
| 75 | + </TableHead> |
| 76 | + <TableBody> |
| 77 | + <TableRow> |
| 78 | + <TableCell>User 1</TableCell> |
| 79 | + <TableCell>Contributor</TableCell> |
| 80 | + </TableRow> |
| 81 | + </TableBody> |
| 82 | + </Table> |
| 83 | +</TableContainer> |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## States |
| 88 | + |
| 89 | +### Sortable Table |
| 90 | + |
| 91 | +Tables can support sorting to help users organize data. |
| 92 | + |
| 93 | +<TableContainer> |
| 94 | + <Table> |
| 95 | + <TableHead> |
| 96 | + <TableRow> |
| 97 | + <TableCell>Name</TableCell> |
| 98 | + <TableCell>Role</TableCell> |
| 99 | + </TableRow> |
| 100 | + </TableHead> |
| 101 | + <TableBody> |
| 102 | + <TableRow> |
| 103 | + <TableCell>User 1</TableCell> |
| 104 | + <TableCell>Contributor</TableCell> |
| 105 | + </TableRow> |
| 106 | + </TableBody> |
| 107 | + </Table> |
| 108 | +</TableContainer> |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +### Selectable Rows |
| 113 | + |
| 114 | +Tables can allow row selection. |
| 115 | + |
| 116 | +<TableContainer> |
| 117 | + <Table> |
| 118 | + <TableHead> |
| 119 | + <TableRow> |
| 120 | + <TableCell>Name</TableCell> |
| 121 | + <TableCell>Role</TableCell> |
| 122 | + </TableRow> |
| 123 | + </TableHead> |
| 124 | + <TableBody> |
| 125 | + <TableRow> |
| 126 | + <TableCell>User 1</TableCell> |
| 127 | + <TableCell>Contributor</TableCell> |
| 128 | + </TableRow> |
| 129 | + </TableBody> |
| 130 | + </Table> |
| 131 | +</TableContainer> |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +### Paginated Table |
| 136 | + |
| 137 | +Tables can support pagination for large datasets. |
| 138 | + |
| 139 | +<TableContainer> |
| 140 | + <Table> |
| 141 | + <TableHead> |
| 142 | + <TableRow> |
| 143 | + <TableCell>Name</TableCell> |
| 144 | + <TableCell>Role</TableCell> |
| 145 | + </TableRow> |
| 146 | + </TableHead> |
| 147 | + <TableBody> |
| 148 | + <TableRow> |
| 149 | + <TableCell>User 1</TableCell> |
| 150 | + <TableCell>Contributor</TableCell> |
| 151 | + </TableRow> |
| 152 | + </TableBody> |
| 153 | + </Table> |
| 154 | +</TableContainer> |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +## Best Practices |
| 159 | + |
| 160 | +- Use headers for clarity |
| 161 | +- Avoid too many columns |
| 162 | +- Keep rows readable |
| 163 | +- Use pagination for large datasets |
| 164 | +- Maintain consistent spacing |
0 commit comments