Component Blueprints

Data Tables

Data tables are an enhanced version of an HTML table and are used to display tabular data.
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000

About Data Tables#

To initialize a data table, apply the slds-table class to the table element. This class creates a table with formatted cells and allows you to use data table utilities.

Accessibility#

To create an accessible table, the top row of column headers (th) are placed in a thead. Each one receives the scope="col" attribute. The first non-actionable (meaning that doesn't contain a checkbox or menu) column in each row should be marked as a th with a scope="row" attribute.

Base#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-table_bordered">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Striped rows#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_striped">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Columns dividers#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Rows with no hover#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-no-row-hover slds-table_bordered">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Single Column table#

<table class="slds-table slds-table_cell-buffer slds-table_bordered">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Headless#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-table_header-hidden slds-table_bordered">
  <thead class="slds-assistive-text">
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

With no borders#

Opportunity Name
Account Name
Close Date
Stage
Confidence
Amount
Contact
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
Cloudhub
4/14/2015
Prospecting
20%
$25k
<table class="slds-table slds-table_cell-buffer slds-table_header-hidden">
  <thead class="slds-assistive-text">
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Actionable mode - Column sorting and row selection(s)#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Single row selection#

Choose a row to select
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Row Selection#

Single row selected#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

All rows selected#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Column sorting#

Sorted Ascending#

Choose a row
Sort by:
Name
Sorted ascending
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Sorted Descending#

Choose a row
Sort by:
Name
Sorted descending
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
Acme
1/31/15
Prospecting
60%
$5,000,000
Acme
4/10/15
Value Proposition
30%
$25,000,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Column resizing#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Column headers with overflow actions button menu#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Column with icons#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Einstein calculated
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Cell with icons#

Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme
4/10/15
Value Proposition
30%
$25,000,000
Text alternative when needed
High
Acme
1/31/15
Prospecting
60%
$5,000,000
salesforce.com
1/31/15 3:45PM
Id. Decision Makers
70%
$25,000
Text alternative when needed
Low
<table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_fixed-layout slds-table_resizable-cols" role="grid">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="slds-text-align_right" scope="col" style="width:3.25rem">

Inline Edit#

Accessibility#

The Advanced Data Table and Inline Edit Data Table are based on the semantics, roles and interaction model of the ARIA Grid. In SLDS we overlay the ARIA Grid on top of native HTML table semantics.

The role of Grid comes with 2 distinct modes, Navigation mode and Actionable mode. Both come with very specific keyboard interaction modals. Navigation mode is the default mode of the Grid.

Navigation Mode

  • Tabbing into the grid focuses the first data cell in the table.
  • The second tab key press takes the user focus out of the grid onto the next focusable element on the page.
  • Once the user has tabbed out of the grid, tabbing back into the grid will return focus to the last cell the user was focused on.
  • Navigation in the grid is accomplished via the arrow keys.
  • No actionable items in cell contents are focusable.
  • Pressing the Enter key on a chosen grid cell, places the entire Grid into Actionable mode.

Actionable Mode

  • Once in Actionable mode, all focusable items in the entire grid can be tabbed to.
  • Arrow navigation still takes the user cell to cell in any direction, but focuses on the first actionable item in the cell, if there is one.
  • Pressing the Escape key exits Actionable mode, placing the user back into Navigation mode, keeping the users cursor on the same cell they were focused in.
  • When interacting with a component in a cell, such as a Menu, that also uses the Escape key as an exit action, pressing Escape will take the user back to the triggering element in the current cell. A subsequent press of Escape will return the user to Navigation mode.

For the purposes of these docs, the Default state of Inline Edit is representative of Navigation mode, all other states are assumed to be in Actionable Mode.

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-no-cell-focus slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Keyboard navigation#

1st cell highlighted (checkbox)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

2nd cell highlighted#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

3rd cell highlighted#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Cell Edit#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Required form element#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Required form element with error#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Edited cell (unsaved)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Edited cell with row selected (unsaved)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Edited cell with row level error (unsaved)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Edited cell with focused row level error (unsaved)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="demo-only" style="margin-top:100px;margin-left:10px">
  <div class="slds-table_edit_container slds-is-relative">
    <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
      <thead>

Edited cell with row selected and row level error (unsaved)#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Header navigation#

Header cell focused#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Header cell marked#

Errors
Choose a row
Sort by:
Name
Sort by:
Account Name
Sort by:
Close Date
Sort by:
Stage
Sort by:
Confidence
Sort by:
Amount
Sort by:
Contact
Actions
Acme - 1,200 WidgetsAcme4/10/15Value Proposition30%$25,000,000jrogers@acme.com
Acme - 200 WidgetsAcme1/31/15Prospecting60%$5,000,000bob@acme.com
salesforce.com - 1,000 Widgetssalesforce.com1/31/15 3:45PMId. Decision Makers70%$25,000nathan@salesforce.com
<div class="slds-table_edit_container slds-is-relative">
  <table aria-multiselectable="true" class="slds-table slds-no-cell-focus slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols" role="grid" style="width:66.75rem">
    <thead>
      <tr class="slds-line-height_reset">

Cell Content#

As a default method, wrap any table cell content in a <div>.

Truncated#

Add the slds-truncate class to truncate any content that might overflow the tables cell area.

Typical Column Header
Truncated, no wrap
Typical Column Header
Typical cell content
Cell content that is very long. It also has a line break. It has more than one line break
Typical cell content
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout slds-table_striped">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Wrapped#

In those cases where long cell content is anticipated, use the slds-cell-wrap class on the cell <td> to have the text wrap within the cell’s width.

Also, use the slds-line-clamp class on the content-wrapping <div> to clamp, or truncate, the cell content after a certain amount of lines. Other line clamping classes can be used in place for various line clamping limits. The clamping limit can also be changed by reassigning a value to the line-clamp token.

Typical Column Header
Wrapped, line clamped
Typical Column Header
Typical cell content
Cell content that is very long. It also has a line break. It has more than one line break
Typical cell content
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout slds-table_striped">
  <thead>
    <tr class="slds-line-height_reset">
      <th class="" scope="col">

Overview of CSS Classes#

Selector.slds-table
Summary

Initializes data table

Supportdev-ready
Restricttable
VariantTrue
Selector.slds-no-row-hover
Summary

Default Table Row Hover

Restrict.slds-table
ModifierTrue
Selector.slds-is-selected
Summary

Selected Table Row + Hover

Restrict.slds-table tr
ModifierTrue
Selector.slds-cell-wrap
Summary

By default, nowrap is applied

Restrict.slds-table th, .slds-table td
ModifierTrue
Selector.slds-cell-buffer_left
Summary

Use to add a left padding buffer to cells

Restrict.slds-table th, .slds-table td
ModifierTrue
Selector.slds-cell-buffer_right
Summary

Use to add a right padding buffer to cells

Restrict.slds-table th, .slds-table td
ModifierTrue
Selector.slds-has-focus
Summary

Focus state on a cell

Restrict.slds-table th, .slds-table td
ModifierTrue
Selector.slds-table_cell-buffer
Summary

Add left and right padding to the first and last cells of a table

Restrict.slds-table
ModifierTrue
Selector.slds-table_bordered
Summary

Add vertical borders to a table

Restrict.slds-table
ModifierTrue
Selector.slds-table_col-bordered
Summary

Add column borders

Restrict.slds-table
ModifierTrue
Selector.slds-table_striped
Summary

Add alternating strips to rows

Restrict.slds-table
ModifierTrue
Selector.slds-table_fixed-layout
Summary

Set table to use fixed layout for width and truncation purposes

Supportdev-ready
Restrict.slds-table
VariantTrue
Selector.slds-is-sortable
Summary

If the column is sortable, then let's handle the actionable region of the <th> cell

Restrict.slds-table_fixed-layout th
Selector.slds-is-sortable__icon
Summary

Icon inside sortable th

Restrict.slds-is-sortable .slds-icon
Selector.slds-has-button-menu
Summary

If the column header has a menu button, then let's add right padding to the header to preserve truncation

Restrict.slds-table_fixed-layout th
Selector.slds-th__action-button
Summary

Allows for alignment of button, such as a menu

Restrict.slds-has-button-menu .slds-button_icon
Selector.slds-is-sorted
Summary

Active state of sorted column

Restrict.slds-table_fixed-layout th
Selector.slds-is-sorted_asc
Summary

Change direction of arrow

Restrict.slds-is-sorted
ModifierTrue
Selector.slds-table_resizable-cols
Summary

Resizable data table columns

Restrict.slds-table_fixed-layout
Selector.slds-is-resizable
Summary

Provide an indicator that resizing is available

Restrict.slds-table_resizable-cols th
Selector.slds-resizable
Summary

Resizable handle

Restrict.slds-is-resizable div
Selector.slds-resizable__handle
Summary

Grab handle to resize column

Restrict.slds-resizable span
Selector.slds-resizable__divider
Summary

Grab handle divider indicator when resizing column

Restrict.slds-resizable__handle span
Selector.slds-th__action
Summary

Actionable area inside th

Restrict.slds-table th div, .slds-table th a
Selector.slds-th__action_form
Summary

Allows for alignment of form element, such as a checkbox

Restrict.slds-th__action
Selector.slds-table_header-hidden
Summary

Used to remove the top border when a table's header is visually hidden

Supportdev-ready
Restrict.slds-table
VariantTrue
Selector.slds-table_edit
Summary

Initiates inline-edit mode for data-tables

Supportdev-ready
Restrict.slds-table
VariantTrue
Selector.slds-cell-error
Summary

Cell that has error icon appear within

Restrict.slds-table_edit td
Selector.slds-cell-edit
Summary

Informs a table cell that it has editing capabilities

Restrict.slds-table_edit th, .slds-table_edit td
Selector.slds-is-edited
Summary

Informs a cell that it has been edited but not saved

Restrict.slds-cell-edit
ModifierTrue
Selector.slds-has-error
Summary

Informs a cell that it has an error inside of it

Restrict.slds-cell-edit
ModifierTrue
Selector.slds-cell-edit__button
Summary
Restrict.slds-cell-edit button
Selector.slds-no-cell-focus
Summary

Handles children of the table where we don't want any focusable cells

Restrict.slds-table_edit
ModifierTrue
Selector.slds-max-medium-table_stacked
Summary

Creates stacked row with stacked cells

Supportprototype
Restrict.slds-table
VariantTrue
Selector.slds-max-medium-table_stacked-horizontal
Summary

Creates stacked rows with horizontal cells

Supportprototype
Restrict.slds-table
ModifierTrue

Data Tables Release Notes

2.12.1

Changed

  • Updated styles for resize handle if final column is resizable.

2.12.0

Changed

  • Changed white-space property to pre-line in slds-cell-wrap for cell content that has pre-formatted line breaks.
  • Adjusted positioning for resize handle for better usability on touch devices, and made the handle visible in all cases

Added

  • Added documentation and examples for wrapping, line clamping and truncating table cell content.

2.11.8

Changed

  • Adjusted positioning for slds-th__action-button for better vertical alignment and made additional changes to support appearance in the touch implementation

2.11.7

Changed

  • Updated height and width dimensions on touch version of slds-th__action-button

2.10.0

Changed

  • Changed slds-th__action-button alignment to use margin-top instead of transform: translateY

2.8.0

Changed

  • Added bold font weight to th elements within table headers.

Removed

  • Removed slds-text-title_caps from table headers.

2.7.0

Added

  • Added a hidden header variation of the data table
    • This involves adding the slds-table_header-hidden class to the <table> and using the slds-assistive-text class on the <thead> to ensure the table remains accessible
  • Multi select data tables now require aria-multiselectable="true" applied to the table element for both Advanced and Inline Edit variants.
  • Multi select data tables now require aria-selected to be set to false on every row that is not selected

Changed

  • Data tables underwent some minor markup changes to help align all the different variants to use common markup patterns. No visual styling or functionality has changed, but you will notice more examples.

Fixed

  • Improved the color contrast of links inside of selected rows