Skip to content

Commit 644662b

Browse files
authored
Merge pull request #272 from RockefellerArchiveCenter/development
improve docs/story for making tables responsive
2 parents 478257a + b01e6bb commit 644662b

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

stories/components/table/Table.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Tables should not be used to control layout of a web page.
1818

1919
- Always use the base `table` class to improve the display of the table.
2020
- Keep tables as simple as possible and avoid tables with many columns that cannot be
21-
made responsive on small screens. Apply the `table-responsive` class to tables
22-
to enable horizontal scrolling when they are too wide for the screen.
21+
made responsive on small screens.
22+
- Apply the `table-responsive` class to a container div around the table
23+
element to enable horizontal scrolling when they are too wide for the screen.
2324

2425
## Related components
2526

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
<table class="table{{#if striped}} table-striped{{/if}}">
2-
<thead>
3-
<tr>
4-
{{#if inputs}}<th id="select">Select</th>{{/if}}
5-
<th{{#if inputs}} id="title"{{/if}}>Title</th>
6-
<th{{#if inputs}} id="date"{{/if}}>Date</th>
7-
</tr>
8-
</thead>
9-
<tbody>
10-
<tr>
11-
{{#if inputs}}<td><input type="checkbox" id="1" aria-labelledby="select row01"></td>{{/if}}
12-
<th scope="row"{{#if inputs}} id="row01"{{/if}}>Pie Making Grant</th>
13-
<td>2021</td>
14-
</tr>
15-
<tr>
16-
{{#if inputs}}<td><input type="checkbox" id="2" aria-labelledby="select row02"></td>{{/if}}
17-
<th scope="row"{{#if inputs}} id="row02"{{/if}}><a href="" target="_blank">Cupcake Makers Association of America</a></th>
18-
<td>2023</td>
19-
</tr>
20-
<tr>
21-
{{#if inputs}}<td><input type="checkbox" id="3" aria-labelledby="select row03"></td>{{/if}}
22-
<th scope="row"{{#if inputs}} id="row03"{{/if}}><a href="" target="_blank">Brownie Purveyors Society</a></th>
23-
<td>2024</td>
24-
</tr>
25-
<tr>
26-
{{#if inputs}}<td><input type="checkbox" id="4" aria-labelledby="select row04"></td>{{/if}}
27-
<th scope="row"{{#if inputs}} id="row04"{{/if}}>Cookie Creation Center</th>
28-
<td>
29-
<ul>
30-
<li>2022</li>
31-
<li>2023</li>
32-
<li>2024</li>
33-
</ul>
34-
</td>
35-
</tr>
36-
</tbody>
37-
</table>
1+
<div class="table-responsive">
2+
<table class="table{{#if striped}} table-striped{{/if}}">
3+
<thead>
4+
<tr>
5+
{{#if inputs}}<th id="select">Select</th>{{/if}}
6+
<th{{#if inputs}} id="title"{{/if}}>Title</th>
7+
<th{{#if inputs}} id="date"{{/if}}>Date</th>
8+
</tr>
9+
</thead>
10+
<tbody>
11+
<tr>
12+
{{#if inputs}}<td><input type="checkbox" id="1" aria-labelledby="select row01"></td>{{/if}}
13+
<th scope="row"{{#if inputs}} id="row01"{{/if}}>Pie Making Grant</th>
14+
<td>2021</td>
15+
</tr>
16+
<tr>
17+
{{#if inputs}}<td><input type="checkbox" id="2" aria-labelledby="select row02"></td>{{/if}}
18+
<th scope="row"{{#if inputs}} id="row02"{{/if}}><a href="" target="_blank">Cupcake Makers Association of America</a></th>
19+
<td>2023</td>
20+
</tr>
21+
<tr>
22+
{{#if inputs}}<td><input type="checkbox" id="3" aria-labelledby="select row03"></td>{{/if}}
23+
<th scope="row"{{#if inputs}} id="row03"{{/if}}><a href="" target="_blank">Brownie Purveyors Society</a></th>
24+
<td>2024</td>
25+
</tr>
26+
<tr>
27+
{{#if inputs}}<td><input type="checkbox" id="4" aria-labelledby="select row04"></td>{{/if}}
28+
<th scope="row"{{#if inputs}} id="row04"{{/if}}>Cookie Creation Center</th>
29+
<td>
30+
<ul>
31+
<li>2022</li>
32+
<li>2023</li>
33+
<li>2024</li>
34+
</ul>
35+
</td>
36+
</tr>
37+
</tbody>
38+
</table>
39+
</div>

0 commit comments

Comments
 (0)