Het <table>
component is gebasseerd op Bootstrap’s Table.
Met de volgende uitzonderingen is de markup identiek aan Bootstrap:
.table-bordered
, .table-condensed
en .table-striped
varianten.tr.primary
en tr.secondary
..table-responsive
functionaliteit.success
, info
, warning
en danger
row-modifiers.Zie Bootstrap Table.
Gebruik tabellen om inhoud logisch te structureren, zodat het gemakkelijker wordt om relaties te zien en te begrijpen. Gebruik een tabel nooit om inhoud op een pagina op te maken. Gebruik in plaats daarvan het gridsysteem.
Het component <table>
wordt als een data-tabel gebruikt of als data-grid.
<table>
tag<th scope="col">
voor koptitels in de kolommen.<th scope="row">
voor koptitels in de rijen.Gebruik een <table>
nooit om inhoud op een pagina op te maken. Dit is ook wel bekend als een layout-tabel. Gebruik in plaats daarvan het responsive grid-systeem om inhoud op een pagina op te maken.
Zie ook: de layout documentatie
<table>
als je wel een koptitel boven de kolommen kunt plaatsen. De kolom kun je als een groep met een koptitel beschouwen.Zie ook: Definition List
Een data grid is een dynamischere weergave van informatie. Het bevat wel interactieve elementen om de tabel aan te passen.
<table>
tag én ARIA table role="grid"
<th>
om koptitels in header te definiëren.role="grid"
wordt vanuit gegaan dat de data in het data-grid aanpasbaar is. Voeg aria-readonly="true"
toe, als de data niet aanpasbaar is.<th>
"role=columnheader"
toe.<th>
"role=rowheader"
toe.<th>
aan met aria-sort="ascending"
. Bij aflopende resultaten, gebruik aria-sort="descending"
.aria-sort
.<caption>
nodig. De caption wordt als een titel opgelezen door een screen reader. Indien deze visueel niet wenselijk is wordt deze verborgen met .sr-only
.<th scope="col">
voor koptitels in de kolommen.<th scope="row">
voor koptitels in de rijen.
<!-- Default -->
<table class="table">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Caption -->
<table class="table">
<caption>Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Hovered -->
<table class="table table-hover">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr class="active">
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr.active</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Table Text Left Aligned -->
<table class="table dso-text-left">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Table Text Centered -->
<table class="table dso-text-center">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Table Text Right Aligned -->
<table class="table dso-text-right">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col">
GitHub gebruikersnaam
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td>fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td>andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td>taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td>HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Column Text Left Aligned -->
<table class="table">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col" class="dso-text-left">
GitHub gebruikersnaam
(column left aligned)
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td class="dso-text-left">fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td class="dso-text-left">andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td class="dso-text-left">taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td class="dso-text-left">HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Column Text Centered -->
<table class="table">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col" class="dso-text-center">
GitHub gebruikersnaam
(column centered)
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td class="dso-text-center">fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td class="dso-text-center">andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td class="dso-text-center">taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td class="dso-text-center">HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
<!-- Column Text Right Aligned -->
<table class="table">
<caption class="sr-only">Overzicht van gebruikersnamen</caption>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Voornaam</th>
<th scope="col">Achternaam</th>
<th scope="col" class="dso-text-right">
GitHub gebruikersnaam
(column right aligned)
</th>
<th scope="col">Modifier</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><a href="#fabien">Fabien</a></td>
<td>Potencier</td>
<td class="dso-text-right">fabpot</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td><a href="#andrew">Andrew</a></td>
<td>Nesbitt</td>
<td class="dso-text-right">andrew</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td><a href="#taylor">Taylor</a></td>
<td>Otwell</td>
<td class="dso-text-right">taylorotwell</td>
<td>
<code>tr</code>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td><a href="#hugo">Hugo</a></td>
<td>Giraudel</td>
<td class="dso-text-right">HugoGiraudel</td>
<td>
<code>tr</code>
</td>
</tr>
</tbody>
</table>
# | Voornaam | Achternaam | GitHub gebruikersnaam {% if columnAlign === 'dso-text-left' %} (column left aligned) {% elif columnAlign === 'dso-text-center' %} (column centered) {% elif columnAlign === 'dso-text-right' %} (column right aligned) {% endif %} | Modifier |
---|---|---|---|---|
1 | Fabien | Potencier | fabpot |
tr
|
2 | Andrew | Nesbitt | andrew |
tr
|
3 | Taylor | Otwell | taylorotwell |
tr{% if activeRow %}.active{% endif %}
|
4 | Hugo | Giraudel | HugoGiraudel |
tr
|
/* Default */
__title: Default
modifier: table
caption: Overzicht van gebruikersnamen
/* Caption */
__title: With caption
modifier: table
caption: Overzicht van gebruikersnamen
showCaption: true
/* Hovered */
__title: Hovered & Active
modifier: table table-hover
caption: Overzicht van gebruikersnamen
activeRow: true
/* Table Text Left Aligned */
__title: Table text left aligned
modifier: table dso-text-left
caption: Overzicht van gebruikersnamen
/* Table Text Centered */
__title: Table text centered
modifier: table dso-text-center
caption: Overzicht van gebruikersnamen
/* Table Text Right Aligned */
__title: Table text right aligned
modifier: table dso-text-right
caption: Overzicht van gebruikersnamen
/* Column Text Left Aligned */
__title: Column text left aligned
modifier: table
caption: Overzicht van gebruikersnamen
columnAlign: dso-text-left
/* Column Text Centered */
__title: Column text centered
modifier: table
caption: Overzicht van gebruikersnamen
columnAlign: dso-text-center
/* Column Text Right Aligned */
__title: Column text right aligned
modifier: table
caption: Overzicht van gebruikersnamen
columnAlign: dso-text-right