|
1 | 1 | --- |
2 | 2 | title: Table Guidance |
3 | 3 | component: table |
4 | | -description: Tables are used to organize and present structured data clearly and efficiently. |
| 4 | +description: Guidelines and best practices for using tables effectively. |
5 | 5 | --- |
6 | 6 |
|
7 | | -import Table from "../../../../components/ConformanceTest-Table" |
8 | | - |
9 | | -Tables help users scan, compare, and understand structured data. Proper usage ensures readability, accessibility, and efficient information delivery. |
10 | | - |
11 | | -<a id="Function"> |
12 | | - <h2>Function</h2> |
13 | | -</a> |
14 | | - |
15 | | -Tables are used when structured data needs to be displayed clearly. They help users compare values, understand relationships, and analyze information efficiently. |
16 | | - |
17 | | -<h3>Data Table</h3> |
18 | | - |
19 | | -Data tables are used to display structured information in rows and columns. |
20 | | - |
21 | | -<Row className="image-container"> |
22 | | - <ThemeWrapper> |
23 | | - <Table> |
24 | | - <thead> |
25 | | - <tr> |
26 | | - <th>Name</th> |
27 | | - <th>Role</th> |
28 | | - <th>Status</th> |
29 | | - </tr> |
30 | | - </thead> |
31 | | - <tbody> |
32 | | - <tr> |
33 | | - <td>User 1</td> |
34 | | - <td>Contributor</td> |
35 | | - <td>Active</td> |
36 | | - </tr> |
37 | | - </tbody> |
38 | | - </Table> |
39 | | - </ThemeWrapper> |
40 | | -</Row> |
41 | | - |
42 | | -<h3>Compact Table</h3> |
43 | | - |
44 | | -Compact tables are used when space is limited or when displaying large datasets. |
45 | | - |
46 | | -<Row className="image-container"> |
47 | | - <ThemeWrapper> |
48 | | - <Table size="small"> |
49 | | - <thead> |
50 | | - <tr> |
51 | | - <th>Name</th> |
52 | | - <th>Role</th> |
53 | | - </tr> |
54 | | - </thead> |
55 | | - <tbody> |
56 | | - <tr> |
57 | | - <td>User 1</td> |
58 | | - <td>Contributor</td> |
59 | | - </tr> |
60 | | - </tbody> |
61 | | - </Table> |
62 | | - </ThemeWrapper> |
63 | | -</Row> |
64 | | - |
65 | | -<a id="Layout"> |
66 | | - <h2>Layout</h2> |
67 | | -</a> |
68 | | - |
69 | | -Tables should maintain consistent spacing and alignment to improve readability. |
70 | | - |
71 | | -### Column Alignment |
72 | | - |
73 | | -- Left align text content |
74 | | -- Right align numeric values |
75 | | -- Center align status indicators |
76 | | - |
77 | | -### Row Spacing |
78 | | - |
79 | | -Maintain consistent row spacing to ensure clarity and readability. |
80 | | - |
81 | | -<a id="Best Practices"> |
82 | | - <h2>Best Practices</h2> |
83 | | -</a> |
84 | | - |
85 | | -- Use headers for clarity |
86 | | -- Avoid overcrowding columns |
87 | | -- Keep rows readable |
88 | | -- Use pagination for large datasets |
89 | | -- Use sorting where applicable |
90 | | -- Maintain consistent spacing |
91 | | - |
92 | | -<a id="Accessibility"> |
93 | | - <h2>Accessibility</h2> |
94 | | -</a> |
95 | | - |
96 | | -- Use semantic table elements |
97 | | -- Provide clear headers |
98 | | -- Maintain contrast for readability |
99 | | -- Ensure keyboard navigation support |
| 7 | +## Function |
| 8 | + |
| 9 | +Tables are used to organize structured data into rows and columns. They help users quickly scan, compare, and understand information. |
| 10 | + |
| 11 | +Tables are useful for: |
| 12 | + |
| 13 | +- Presenting structured data |
| 14 | +- Comparing multiple values |
| 15 | +- Displaying logs and metrics |
| 16 | +- Listing users or resources |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +Use tables when: |
| 23 | + |
| 24 | +- Data must be compared |
| 25 | +- Information is structured |
| 26 | +- Users need quick scanning |
| 27 | +- Displaying rows and columns |
| 28 | + |
| 29 | +Avoid using tables when: |
| 30 | + |
| 31 | +- Content is mostly text |
| 32 | +- Layout is simple |
| 33 | +- Data does not require comparison |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Best Practices |
| 38 | + |
| 39 | +Follow these best practices when using tables: |
| 40 | + |
| 41 | +- Use clear headers |
| 42 | +- Avoid too many columns |
| 43 | +- Keep rows readable |
| 44 | +- Use pagination for large datasets |
| 45 | +- Maintain consistent spacing |
| 46 | + |
| 47 | +### Use Clear Headers |
| 48 | + |
| 49 | +Always include headers for better readability. |
| 50 | + |
| 51 | +```html |
| 52 | +<table> |
| 53 | + <thead> |
| 54 | + <tr> |
| 55 | + <th>Name</th> |
| 56 | + <th>Role</th> |
| 57 | + </tr> |
| 58 | + </thead> |
| 59 | +</table> |
0 commit comments