Skip to content
Dalvan UI

Data Table

Present related records in rows and columns with native table semantics.

Playground

Project milestones
MilestoneStatus
DesignComplete
ReviewIn progress
ReleaseScheduled
<table class="dv-data-table dv-data-table--row-line dv-data-table--col-none dv-appearance-paper">
  <caption>Project milestones</caption>
  <thead>
    <tr><th scope="col">Milestone</th><th scope="col">Status</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Design</th><td>Complete</td></tr>
    <tr><th scope="row">Review</th><td>In progress</td></tr>
    <tr><th scope="row">Release</th><td>Scheduled</td></tr>
  </tbody>
</table>

Usage

After setting up the CSS, add dv-data-table to a table with header cells. Include a caption when the surrounding text does not identify the table.

<table class="dv-data-table dv-data-table--row-line">
  <caption>Project milestones</caption>
  <thead>
    <tr><th scope="col">Milestone</th><th scope="col">Status</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Design</th><td>Complete</td></tr>
    <tr><th scope="row">Review</th><td>In progress</td></tr>
    <tr><th scope="row">Release</th><td>Scheduled</td></tr>
  </tbody>
</table>

Examples

Row and column separators

Use one row option and one column option. Line draws borders, gap adds space, and none disables the separator. The defaults are row lines and no column separator.

Project milestones
MilestoneStatus
DesignComplete
ReviewIn progress
ReleaseScheduled
<table class="dv-data-table dv-data-table--sm dv-data-table--row-gap dv-data-table--col-line dv-appearance-paper">
  <caption>Project milestones</caption>
  <thead>
    <tr><th scope="col">Milestone</th><th scope="col">Status</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Design</th><td>Complete</td></tr>
    <tr><th scope="row">Review</th><td>In progress</td></tr>
    <tr><th scope="row">Release</th><td>Scheduled</td></tr>
  </tbody>
</table>

Striped and hover rows

Striping shades even rows. Hover shading is applied on devices that support hover. Add an appearance to provide the surface and its hover color.

Project milestones
MilestoneStatus
DesignComplete
ReviewIn progress
ReleaseScheduled
<table class="dv-data-table dv-data-table--striped dv-data-table--hoverable dv-color-primary dv-appearance-subtle">
  <caption>Project milestones</caption>
  <thead>
    <tr><th scope="col">Milestone</th><th scope="col">Status</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Design</th><td>Complete</td></tr>
    <tr><th scope="row">Review</th><td>In progress</td></tr>
    <tr><th scope="row">Release</th><td>Scheduled</td></tr>
  </tbody>
</table>

API reference

Class or attributeBehavior
dv-data-tableStyles the native table, caption and cells. Use scope on row and column headers.
dv-data-table--smdv-data-table--mddv-data-table--lgControls cell padding. Medium is the default.
dv-data-table--row-linedv-data-table--row-nonedv-data-table--row-gapSets the separator between rows.
dv-data-table--col-linedv-data-table--col-nonedv-data-table--col-gapSets the separator between columns.
dv-data-table--stripeddv-data-table--hoverableOptional row treatments.

Customization

Use the table tokens to tune density, separators, and cell surfaces.

PropertyEffect and defaults
--dv-data-table-padding-block / --dv-data-table-padding-inlineCell padding set by the selected size.
--dv-data-table-row-gap / --dv-data-table-col-gapSpacing for the gap variants. Both default to space-75.
--dv-data-table-border-colorColor of line separators. Defaults to the shared border color.
--dv-data-table-radiusCorner radius used by gap variants. Defaults to the medium radius.
--dv-data-table-row-backgroundSet on a row to override the surface painted by its cells.