An official website of the United States government
Here’s how you know
Official websites use .gov A
.gov website belongs to an official government
organization in the United States.
Secure .gov websites use HTTPS A
lock (
) or https:// means you’ve safely connected to
the .gov website. Share sensitive information only on official,
secure websites.
Tables help logically organize information and group like things together, and they make it easier to understand complex content, as explained on plainlanguage.gov. They’re especially useful for showing long lists of sequential or structured content. Users read tables one row or column at a time, making it easy to digest and compare information.
Tables also help users find specific information within a large data set. For example, if someone is looking for how much their tax is based on their income for a particular year, it’s much easier to find the intersection of that year and income range than to scan or read an entire paragraph of text.
Standard table
Bordered table
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Striped table
A striped table can improve readability by visually grouping row content with alternating background colors.
Bordered table with horizontal stripes
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Borderless table
A borderless table can be useful when you want the information to feel more a part of the text it accompanies and extends.
Borderless table: A borderless table can be useful when you want the
information to feel more a part of the text it accompanies and extends.
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Scrollable table
A scrollable table is ideal for dense data.
Scrollable table
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Scrollable table with horizontal stripes
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Compact scrollable table
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Compact scrollable table with horizontal stripes
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Responsive stacked table
A responsive stacked table collapses at narrow widths for better readability on small screens.
Bordered table
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Stacked borderless table (when on a
mobile-width
screen)
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Stacked bordered table with headers (when on a mobile-width screen)
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Stacked borderless table with headers (when on a mobile-width screen)
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Sortable table rows
A sorted column changes the row ordering based on alphabetical or numeric cell values.
Recently admitted US states (sortable table example)
Name
Order admitted to union
Date of ratification vote
Date admitted to union
Percent of voters in favor of ratification
Votes cast in favor of ratification
Estimated population at time of admission
Hawaii
50th
Jun. 27, 1959
Aug. 21, 1959
94.3%
132,773
632,772
Alaska
49th
Apr. 24, 1956
Jan. 3, 1959
68.1%
17,477
226,167
Arizona
48th
Feb. 9, 1911
Feb. 14, 1912
78.7%
12,187
204,354
New Mexico
47th
Nov. 5, 1911
Jan. 6, 1912
70.3%
31,742
327,301
Oklahoma
46th
Sep. 17, 1907
Nov. 16, 1907
71.2%
180,333
1,657,155
Utah
45th
Nov. 5, 1895
Jan. 4, 1896
80.5%
31,305
210,779
Data for illustration purposes only.
Sortable striped table with various content types
Alphabetical
Month
Percent
Count
Rank (Ordinal)
Rank (Cardinal)
Unix Timestamp
Tango
March
20.6%
23,612
Third
3rd
March 27, 2012
Foxtrot
April
2.6%
-32
First
1st
April 9, 2021
Hilo
January
-3.6%
0.002
Second
2nd
January 20, 2021
Bravo
December
-300.6%
0
Fourth
4th
December 16, 2020
Sortable borderless table with various content types
Alphabetical
Month
Percent
Count
Rank (Ordinal)
Rank (Cardinal)
Unix Timestamp
Tango
March
20.6%
23,612
Third
3rd
March 27, 2012
Foxtrot
April
2.6%
-32
First
1st
April 9, 2021
Hilo
January
-3.6%
0.002
Second
2nd
January 20, 2021
Bravo
December
-300.6%
0
Fourth
4th
December 16, 2020
Sticky table headers
Sticky table headers keep tabular data in context by sticking table headers to the top of the page as the user scrolls.
Sticky header table
Document title
Description
Year
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Declaration of Independence
Statement adopted by the Continental Congress declaring independence
from the British Empire.
1776
Bill of Rights
The first ten amendments of the U.S. Constitution guaranteeing rights
and freedoms.
1791
Declaration of Sentiments
A document written during the Seneca Falls Convention outlining the
rights that American women should be entitled to as citizens.
1848
Emancipation Proclamation
An executive order granting freedom to slaves in designated southern
states.
1863
Guidance
When to use the table component
Displaying tabular data. When you need to display tabular information, such as statistical data.
Displaying directories. When listing locations or resources that have similarly structured content for many items.
Robust data visualization. If you need to display more complex relationships or data visualizations, consider a bar graph, infographic, or other type of chart.
Dashboards and other layouts. Don’t use tables in place of a layout grid. Table content should follow a consistent structure using headers and logical columns and rows.
Long-form content. Table cell content should be brief and scannable. If you find yourself drafting multiple bullet points or paragraphs within a single table cell, the content is likely better off under conventional page headers or in an accordion.
Groups of items with different structures. Consider a list or cards for content items that don’t follow a consistent pattern.
Usability guidance
Keep it simple. Tables are great at displaying data and complex information. Minimal visual styling helps surface this information more easily.
Always use a header row. Use plain language and short labels to define the type of information that can be found in each column or row. For more complex table structures, review the WCAG accessibility recommendations for tables.
Predictably format columns. Take care not to vary units or formatting within the same column. Instead, normalize values so they can be easily compared. For example, if most of the rows in a table show a count in days, don’t have some rows that count by weeks.
Right-align numerical data. Align numbers that represent a sum to the right using the text alignment utilities on the table cells.
Use a monospace font for numerical data. For even better readability of dense, numerical data, consider formatting numbers that convey amounts, such as percentages, currency, or tallies, in a monospace font. (There’s no need to apply monospace formatting or alignment to phone numbers, zip codes, dates, or other number content that can’t be totaled.)
Attribute table data in a caption. If your table includes information from a specific source or contains frequently updated content, provide the source and/or last updated date. This clarification is especially useful if your table summarizes data from a more extensive source.
Consider a small-screen experience. On mobile devices and other small screens, numerical data across many columns can be easier to understand if the table scrolls horizontally. Directory lists are more readable if the rows display in a stacked layout. For tables with more than two columns, make sure you choose either a scrollable or a stacked variant.
Minimize the number of columns. It’s easier for users to read down a long list of rows than it is to read across a long list of columns. Eliminate columns when possible, or consider swapping the columns and rows to improve scannability.
Enable sort where useful. Add row sorting to individual columns of long tables where the data can be logically ordered either alphabetically or numerically.
Don’t use row sorting with merged cells. Sorting won’t work properly if your table contains colspan or rowspan attributes on the cells.
Don’t use row sorting with the mobile stacked variants. Sorting won’t work properly with these variants because the column headers at the top of the table don’t appear at narrow widths and are instead moved into the cell content in each row.
Accessibility guidance
Test the table component in your own project.
USWDS tested the table component for accessibility. You should test your implementation, too.
Simple tables can have up to two rows of headers. Each header cell should have scope="col" or scope="row".
Complex tables have more than two levels of headers. Each header should have a unique id and each data cell should have a headers attribute with each related header cell’s id listed.
Add title and attribution in a caption. When adding a title, attribution, or a last-updated date to a table, include it in the <caption> tag inside of the <table> element.
Add an aria-live region to the page when enabling row sorting. An aria-live region immediately following the <table> element automatically announces when the sort state changes for visitors using screen readers, but it must be added to the HTML document before load:
<div class="usa-sr-only usa-table__announcement-region" aria-live="polite"></div>
Don’t add aria-label attributes to sortable column headers. Enabling row sorting automatically adds aria-label attributes to the sortable column headers and their toggle sort buttons via JavaScript. These labels are updated to reflect each column’s current sort state (ascending, descending, or unsorted) whenever sort changes.
Scrollable tables need to be focusable. When you use the .usa-table-container--scrollable variant with a table, you must add the tabindex="0" attribute to the scrollable element. This attribute assures that users navigating with a keyboard are able to select and scroll the table. tabindex="0" enables focus on elements that do not get focus by default. This attribute does not change the tab order. It places the element in the logical navigation flow.
Using the table component
Enable row sorting on columns with sortable data. To activate row sorting, add the data-sortable attribute to the table header element (<th>) of any column with sortable data, and insert an element with the aria-live="polite" attribute and the class .usa-table__announcement-region immediately following the table.
Set a default sort column and direction. To sort a table’s rows by a specific sortable column on load, add the attribute aria-sort equal to a sort direction, such as “ascending” or “descending,” to that column header as in the following example:
<th data-sortable aria-sort="ascending" scope="col">.
Provide raw values for cells with formatted number content. If you have formatted your cell content for display (such as using percent, currency, or comma formatting) or if your cell content is non-numeric but should be sorted in a numeric order (such as months, days of the week, or dates), provide a numeric-sortable value in a data-sort-value attribute on each table cell. Examples follow:
<td data-sort-value="327092400"> Aug. 21, 1959 </td>
File sizes, in bytes:
<td data-sort-value="1126501"> 1.1MB </td>
Table settings
Variable
Description
$theme-table-background-color
Defines the table background color. A value of default uses the body background color.
$theme-table-border-color
Defines a border color for table cells. A value of default uses either the default text or reverse text color depending on the site background color.
$theme-table-header-background-color
Defines a background color for header cells.
$theme-table-header-text-color
Defines a text color for header cells. A value of default uses either the default text or reverse text color depending on the header background color.
$theme-table-sorted-background-color
Defines a background color for the cells of the sorted column.
$theme-table-sorted-header-background-color
Defines a background color for the sorted column header.
$theme-table-sorted-icon-color
Defines a fill color for the activated sort button in a sortable column header. A value of default uses either the default text or reverse text color depending on the sorted column header background color.
$theme-table-sorted-stripe-background-color
Defines a background color for the alternating horizontal stripes applied to cells of the sorted column.
$theme-table-sticky-top-offset
Defines the top offset for sticky headers. This setting value must include the CSS unit type, for example 10px or 2rem.
$theme-table-stripe-background-color
Defines a background color for alternating horizontal stripes in the striped table variant.
$theme-table-stripe-text-color
Defines a text color for alternating horizontal stripes in the striped table variant. A value of default uses either the default text or reverse text color depending on the stripe background color.
$theme-table-text-color
Defines a text color for table cells. A value of default uses either the default text or reverse text color depending on the site background color.
$theme-table-unsorted-icon-color
Defines a fill color for the unactivated sort button in a sortable column header.
Table variants
Variant
Description
.usa-table--borderless
Removes the outer table borders, retaining only a single bottom border on each row. Best for tables with more text than numbers.
.usa-table--compact
Reduces the row height and vertical spacing to display more table rows within a limited space. Should only be used with dense, numerical data, not text content. Pairs well with scrollable and striped variants, but is not suitable for use with stacked variants.
.usa-table-container--scrollable > .usa-table
Add the usa-table-container--scrollable class to a container around any usa-table to apply a horizontal scrollbar if the columns exceed the available width. Ideal for dense tables with many columns.
.usa-table--stacked
Stacks the table cells on narrow screens. Ideal for tables that contain more text information than numerical data. If you use this variant, you must ensure there is a data-label attribute on each cell of the table that matches the column header.
.usa-table--stacked-header
Stacks the table cells on narrow screens and visually promotes the first cell of every row into a “header” for that group. Preferred for directories and other lists where the first cell of every row is a name. If you use this variant, you must ensure there is a data-label attribute on each cell of the table that matches the column header.
.usa-table--sticky-header
Allows the table header element to stick to the top of the page as the user scrolls. Preferred for long tables with many rows. This variant is not compatible with the scrollable and stacked table variants.
.usa-table--striped
Applies alternating horizontal striping to help the eye track across table rows. Pairs well with the scrollable variant for tables with many columns.
Package
Package usage:@forward "usa-table";
Dependencies: uswds-fonts
Latest updates
Meaningful code and guidance updates are listed in the following table:
Updated table header styles to be consistent across all table elements.
Now, all thead th, tbody th, and tfoot th cells will have the same visual styles. Teams should confirm that their tables display as expected.
More information:
uswds#5986
2024-03-20
N/A
Guidance
No
Added WCAG compliance tag and accessibility test status section.
More information:
uswds-site#2538
Created the .usa-table--sticky-header variant to allow sticky positioning on table headers.
Also added the $theme-table-sticky-top-offset setting, which controls the top position of sticky headers.
More information:
uswds#5420
Simplified the structure of the scrollable table component example.
Empty headers in the complex table example were causing accessibility issues.
More information:
uswds#5783
Fixed a typo in the sortable table JavaScript that caused the aria-label in table headers to have an unnecessary single quote.
More information:
uswds#5280
Updated default values for table settings.
Changed values of $theme-table-border-color, $theme-table-header-text-color, $theme-table-stripe-text-color, and $theme-table-text-color from default to ink.
More information:
uswds#3950
Added new table settings.
Added $theme-table-sorted-header-background-color, $theme-table-sorted-background-color, $theme-table-sorted-stripe-background-color, and $theme-table-sorted-icon-color, and $theme-table-unsorted-icon-color .
More information:
uswds#3950