Table
Tables style native <table> markup. Wrap one in table-wrap so wide tables scroll horizontally instead of breaking the layout.
Playground
Flip a class and watch it change. The markup below follows along.
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
| Linus | Maintainer | Active |
<table class="table">
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
<tr><td>Linus</td><td>Maintainer</td><td>Active</td></tr>
</tbody>
</table>Class names
| Class name | Type | Description |
|---|---|---|
table | Component | Base table with borders and a shaded header |
table-wrap | Part | Scroll container; add role="region", an aria-label and tabindex="0" |
table-zebra | Style | Shade every second body row |
table-hover | Style | Highlight the body row under the pointer |
table-sm | Size | Compact cell padding |
Table
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
| Linus | Maintainer | Active |
<table class="table">
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
<tr><td>Linus</td><td>Maintainer</td><td>Active</td></tr>
</tbody>
</table>Zebra
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
| Linus | Maintainer | Active |
| Margaret | Lead | Active |
<table class="table table-zebra">
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
<tr><td>Linus</td><td>Maintainer</td><td>Active</td></tr>
<tr><td>Margaret</td><td>Lead</td><td>Active</td></tr>
</tbody>
</table>Hover
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
| Linus | Maintainer | Active |
<table class="table table-hover">
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
<tr><td>Linus</td><td>Maintainer</td><td>Active</td></tr>
</tbody>
</table>Compact
Only a compact size exists; the default has no class.
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
<table class="table table-sm">
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
</tbody>
</table>With a caption
| Name | Role | Status |
|---|---|---|
| Ada | Engineer | Active |
| Grace | Admiral | Away |
<table class="table table-zebra">
<caption>Team members and their current status</caption>
<thead>
<tr><th scope="col">Name</th><th scope="col">Role</th><th scope="col">Status</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td><td>Active</td></tr>
<tr><td>Grace</td><td>Admiral</td><td>Away</td></tr>
</tbody>
</table>Scrollable wrapper
The wrapper is focusable so keyboard users can scroll it; label it for screen readers.
| Name | Role | Last seen | Plan | |
|---|---|---|---|---|
| Ada Lovelace | ada@example.com | Engineer | Today | Pro |
| Grace Hopper | grace@example.com | Admiral | Yesterday | Team |
| Linus Torvalds | linus@example.com | Maintainer | Last week | Free |
<div class="table-wrap" role="region" aria-label="Users" tabindex="0">
<table class="table table-zebra table-hover">
<thead>
<tr><th scope="col">Name</th><th scope="col">Email</th><th scope="col">Role</th><th scope="col">Last seen</th><th scope="col">Plan</th></tr>
</thead>
<tbody>
<tr><td>Ada Lovelace</td><td>ada@example.com</td><td>Engineer</td><td>Today</td><td>Pro</td></tr>
<tr><td>Grace Hopper</td><td>grace@example.com</td><td>Admiral</td><td>Yesterday</td><td>Team</td></tr>
<tr><td>Linus Torvalds</td><td>linus@example.com</td><td>Maintainer</td><td>Last week</td><td>Free</td></tr>
</tbody>
</table>
</div>