Skip to content
v0.9.1
Components

Table

Clean rows with thin lines and an ink rule under the header. Wrap it in .table-wrap for the bordered box that scrolls sideways on small screens.

Basic

A caption sits quietly under the table, and a <tfoot> row gets an ink line and bold text for totals. Use .num to right-align numbers.

Your recent invoices.
InvoiceStatusMethodAmount
INV-00123PaidCredit card$250.00
INV-00118PendingPayPal$150.00
INV-00105UnpaidBank transfer$350.00
INV-00092PaidCredit card$450.00
Total$1,200.00
<div class="table-wrap">
  <table class="table">
    <caption>Your recent invoices.</caption>
    <thead>
      <tr><th>Invoice</th><th>Status</th><th>Method</th><th class="num">Amount</th></tr>
    </thead>
    <tbody>
      <tr><td>INV-00123</td><td><span class="badge badge-green">Paid</span></td><td>Credit card</td><td class="num">$250.00</td></tr>
      <tr><td>INV-00118</td><td><span class="badge badge-yellow">Pending</span></td><td>PayPal</td><td class="num">$150.00</td></tr>
      <tr><td>INV-00105</td><td><span class="badge badge-red">Unpaid</span></td><td>Bank transfer</td><td class="num">$350.00</td></tr>
      <tr><td>INV-00092</td><td><span class="badge badge-green">Paid</span></td><td>Credit card</td><td class="num">$450.00</td></tr>
    </tbody>
    <tfoot>
      <tr><td colspan="3">Total</td><td class="num">$1,200.00</td></tr>
    </tfoot>
  </table>
</div>

People, actions and pages

A full list: .person cells, .cell-actions with flat icon buttons, a .cell-check column with a select-all box, sortable headers (data-momo-sort), and a .table-foot with a .pager. Click the headers to sort; tick boxes to highlight rows.

NameEmployee IDPhoneJoin dateRoleActions
VPVictoria Perezvictoria@momo.test
LA-0234+1 416 555 014230 Apr 2020Web developer
EHEula Hortoneula@momo.test
LA-0187+1 416 555 01992 Nov 2021Web designer
LFLucy Foxlucy@momo.test
LA-0311+1 416 555 010715 Jun 2019Product manager
IHIna Hoganina@momo.test
LA-0099+1 416 555 01638 Jan 2018Web designer
4 of 24 people
<div class="table-wrap shadow">
  <table class="table table-hover" data-momo-sort id="people">
    <thead>
      <tr>
        <th class="cell-check"><label class="check"><input type="checkbox" data-momo-check-all="#people tbody .cell-check input" aria-label="Select all"></label></th>
        <th>Name</th><th>Employee ID</th><th>Phone</th><th>Join date</th><th>Role</th><th data-momo-nosort><span class="visually-hidden">Actions</span></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="cell-check"><label class="check"><input type="checkbox" aria-label="Select Victoria Perez"></label></td>
        <td><div class="person"><span class="avatar avatar-sm bg-violet">VP</span><span class="person-text"><span class="person-name">Victoria Perez</span><span class="person-sub">victoria@momo.test</span></span></div></td>
        <td>LA-0234</td><td class="nowrap">+1 416 555 0142</td><td data-sort="2020-04-30" class="nowrap">30 Apr 2020</td><td>Web developer</td>
        <td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Victoria"><i class="mi mi-pencil"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Delete Victoria"><i class="mi mi-trash-2"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="View Victoria"><i class="mi mi-eye"></i></button></div></td>
      </tr>
      <tr>
        <td class="cell-check"><label class="check"><input type="checkbox" aria-label="Select Eula Horton"></label></td>
        <td><div class="person"><span class="avatar avatar-sm bg-cyan">EH</span><span class="person-text"><span class="person-name">Eula Horton</span><span class="person-sub">eula@momo.test</span></span></div></td>
        <td>LA-0187</td><td class="nowrap">+1 416 555 0199</td><td data-sort="2021-11-02" class="nowrap">2 Nov 2021</td><td>Web designer</td>
        <td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Eula"><i class="mi mi-pencil"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Delete Eula"><i class="mi mi-trash-2"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="View Eula"><i class="mi mi-eye"></i></button></div></td>
      </tr>
      <tr>
        <td class="cell-check"><label class="check"><input type="checkbox" aria-label="Select Lucy Fox"></label></td>
        <td><div class="person"><span class="avatar avatar-sm bg-orange">LF</span><span class="person-text"><span class="person-name">Lucy Fox</span><span class="person-sub">lucy@momo.test</span></span></div></td>
        <td>LA-0311</td><td class="nowrap">+1 416 555 0107</td><td data-sort="2019-06-15" class="nowrap">15 Jun 2019</td><td>Product manager</td>
        <td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Lucy"><i class="mi mi-pencil"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Delete Lucy"><i class="mi mi-trash-2"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="View Lucy"><i class="mi mi-eye"></i></button></div></td>
      </tr>
      <tr>
        <td class="cell-check"><label class="check"><input type="checkbox" aria-label="Select Ina Hogan"></label></td>
        <td><div class="person"><span class="avatar avatar-sm bg-yellow">IH</span><span class="person-text"><span class="person-name">Ina Hogan</span><span class="person-sub">ina@momo.test</span></span></div></td>
        <td>LA-0099</td><td class="nowrap">+1 416 555 0163</td><td data-sort="2018-01-08" class="nowrap">8 Jan 2018</td><td>Web designer</td>
        <td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Ina"><i class="mi mi-pencil"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Delete Ina"><i class="mi mi-trash-2"></i></button><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="View Ina"><i class="mi mi-eye"></i></button></div></td>
      </tr>
    </tbody>
  </table>
  <div class="table-foot">
    <span>4 of 24 people</span>
    <nav aria-label="Pages">
      <ul class="pager">
        <li><a href="#" aria-label="Previous page" aria-disabled="true"><i class="mi mi-chevron-left"></i></a></li>
        <li><a href="#" aria-current="page">1</a></li>
        <li><a href="#">2</a></li>
        <li><a href="#">3</a></li>
        <li><span>…</span></li>
        <li><a href="#">6</a></li>
        <li><a href="#" aria-label="Next page"><i class="mi mi-chevron-right"></i></a></li>
      </ul>
    </nav>
  </div>
</div>

Rows become cards on phones

Add .table-stack and a data-label on each cell: under 640px wide, each row turns into a small card with the labels on the left. No sideways scrolling.

PaymentDateStatusAmount
Online order
Oct 24, 10:42Completed+$450.00
Cloud hosting
Oct 23, 09:15Pending-$120.00
Team chat
Oct 22, 16:30Completed-$15.00
<div class="table-wrap">
  <table class="table table-stack">
    <thead><tr><th>Payment</th><th>Date</th><th>Status</th><th class="num">Amount</th></tr></thead>
    <tbody>
      <tr><td><div class="person"><span class="avatar avatar-sm avatar-square bg-pink"><i class="mi mi-shopping-bag"></i></span><span class="person-name">Online order</span></div></td><td data-label="Date">Oct 24, 10:42</td><td data-label="Status"><span class="badge badge-green">Completed</span></td><td data-label="Amount" class="num">+$450.00</td></tr>
      <tr><td><div class="person"><span class="avatar avatar-sm avatar-square bg-cyan"><i class="mi mi-cloud"></i></span><span class="person-name">Cloud hosting</span></div></td><td data-label="Date">Oct 23, 09:15</td><td data-label="Status"><span class="badge badge-yellow">Pending</span></td><td data-label="Amount" class="num">-$120.00</td></tr>
      <tr><td><div class="person"><span class="avatar avatar-sm avatar-square bg-yellow"><i class="mi mi-message-square"></i></span><span class="person-name">Team chat</span></div></td><td data-label="Date">Oct 22, 16:30</td><td data-label="Status"><span class="badge badge-green">Completed</span></td><td data-label="Amount" class="num">-$15.00</td></tr>
    </tbody>
  </table>
</div>

Make the window narrow, or open this page on a phone, to see it.

Styles

.table-head-fill tints the header, .table-striped shades every other row, .table-lines draws ink lines everywhere, .table-sm is compact.

SprintDonePoints
Sprint 4018/2042
Sprint 4115/2036
Sprint 4214/2031

ProductCategoryStock
CameraTechnology140
SneakersClothing239
HeadphonesTechnology155
WatchesSmart wear38
<div class="table-wrap">
  <table class="table table-sm table-lines table-head-fill">
    <thead><tr><th>Sprint</th><th>Done</th><th class="num">Points</th></tr></thead>
    <tbody>
      <tr><td>Sprint 40</td><td>18/20</td><td class="num">42</td></tr>
      <tr><td>Sprint 41</td><td>15/20</td><td class="num">36</td></tr>
      <tr><td>Sprint 42</td><td>14/20</td><td class="num">31</td></tr>
    </tbody>
  </table>
</div>
<p></p>
<div class="table-wrap">
  <table class="table table-striped">
    <thead><tr><th>Product</th><th>Category</th><th class="num">Stock</th></tr></thead>
    <tbody>
      <tr><td>Camera</td><td>Technology</td><td class="num">140</td></tr>
      <tr><td>Sneakers</td><td>Clothing</td><td class="num">239</td></tr>
      <tr><td>Headphones</td><td>Technology</td><td class="num">155</td></tr>
      <tr><td>Watches</td><td>Smart wear</td><td class="num">38</td></tr>
    </tbody>
  </table>
</div>

Striped columns and group lines

.table-striped-columns tints every second column: good for tables you read downwards, like a plan comparison. .table-group-divider on a <tbody> (or one row) draws a thicker line above it, to part groups of rows.

PlanFreeTeamBusiness
Storage5 GB50 GB500 GB
Projects325No limit
Team members110No limit
SupportEmailEmail and chatPhone
<div class="table-wrap">
  <table class="table table-striped-columns" id="tb-cols">
    <thead><tr><th>Plan</th><th>Free</th><th>Team</th><th>Business</th></tr></thead>
    <tbody>
      <tr><th scope="row">Storage</th><td>5 GB</td><td>50 GB</td><td>500 GB</td></tr>
      <tr><th scope="row">Projects</th><td>3</td><td>25</td><td>No limit</td></tr>
    </tbody>
    <tbody class="table-group-divider">
      <tr><th scope="row">Team members</th><td>1</td><td>10</td><td>No limit</td></tr>
      <tr><th scope="row">Support</th><td>Email</td><td>Email and chat</td><td>Phone</td></tr>
    </tbody>
  </table>
</div>

Sizes

.table-sm is compact, the default sits in the middle, .table-lg is roomy with larger text.

SmallQty
Mugs12
Totes40
DefaultQty
Mugs12
Totes40
LargeQty
Mugs12
Totes40
<div class="grid lg:grid-cols-3 gap-4 items-start">
  <div class="table-wrap"><table class="table table-sm"><thead><tr><th>Small</th><th class="num">Qty</th></tr></thead><tbody><tr><td>Mugs</td><td class="num">12</td></tr><tr><td>Totes</td><td class="num">40</td></tr></tbody></table></div>
  <div class="table-wrap"><table class="table"><thead><tr><th>Default</th><th class="num">Qty</th></tr></thead><tbody><tr><td>Mugs</td><td class="num">12</td></tr><tr><td>Totes</td><td class="num">40</td></tr></tbody></table></div>
  <div class="table-wrap"><table class="table table-lg"><thead><tr><th>Large</th><th class="num">Qty</th></tr></thead><tbody><tr><td>Mugs</td><td class="num">12</td></tr><tr><td>Totes</td><td class="num">40</td></tr></tbody></table></div>
</div>

Header colors

.table-head-<color> fills the header with a pop color, .table-head-<color>-soft with a soft tint, .table-head-ink with ink.

PlanSeatsPrice
Starter3$9
Team10$29
PlanSeatsPrice
Starter3$9
Team10$29
PlanSeatsPrice
Starter3$9
Team10$29
<div class="stack gap-4">
  <div class="table-wrap"><table class="table table-head-violet"><thead><tr><th>Plan</th><th>Seats</th><th class="num">Price</th></tr></thead><tbody><tr><td>Starter</td><td>3</td><td class="num">$9</td></tr><tr><td>Team</td><td>10</td><td class="num">$29</td></tr></tbody></table></div>
  <div class="table-wrap"><table class="table table-head-lime-soft"><thead><tr><th>Plan</th><th>Seats</th><th class="num">Price</th></tr></thead><tbody><tr><td>Starter</td><td>3</td><td class="num">$9</td></tr><tr><td>Team</td><td>10</td><td class="num">$29</td></tr></tbody></table></div>
  <div class="table-wrap"><table class="table table-head-ink"><thead><tr><th>Plan</th><th>Seats</th><th class="num">Price</th></tr></thead><tbody><tr><td>Starter</td><td>3</td><td class="num">$9</td></tr><tr><td>Team</td><td>10</td><td class="num">$29</td></tr></tbody></table></div>
</div>

Width

A table fills its box. .table-fit shrinks the table and its box to the content. Any width works too: style="--table-width: 32rem" on the table, or a width on the box. .table-fixed makes columns keep the widths you give their headers, and long text is cut with "…".

FitScore
Ana92
Max87
Fixed 20%50%The rest
ShortA long note that keeps going and going so it gets cut neatly at the edgeDone
<div class="stack gap-4">
  <div class="table-wrap"><table class="table table-sm table-fit"><thead><tr><th>Fit</th><th class="num">Score</th></tr></thead><tbody><tr><td>Ana</td><td class="num">92</td></tr><tr><td>Max</td><td class="num">87</td></tr></tbody></table></div>
  <div class="table-wrap"><table class="table table-sm table-fixed"><thead><tr><th style="width: 20%">Fixed 20%</th><th style="width: 50%">50%</th><th>The rest</th></tr></thead><tbody><tr><td>Short</td><td>A long note that keeps going and going so it gets cut neatly at the edge</td><td>Done</td></tr></tbody></table></div>
</div>

Flush

.table-flush drops the box and the outer padding, so the table lines up with the text around it: good inside a card.

This week

DayOrders
Monday38
Tuesday41
Wednesday29
<div class="card w-96">
  <div class="card-body">
    <h3 class="card-title">This week</h3>
    <table class="table table-sm table-flush">
      <thead><tr><th>Day</th><th class="num">Orders</th></tr></thead>
      <tbody><tr><td>Monday</td><td class="num">38</td></tr><tr><td>Tuesday</td><td class="num">41</td></tr><tr><td>Wednesday</td><td class="num">29</td></tr></tbody>
    </table>
  </div>
</div>

Row highlights

.is-highlight on a row marks it in yellow; .row-<color> gives any soft tint. Momo.table.flash(row) blinks a row that just changed (it fades back by itself).

OrderStatusTotal
#10421Shipped$129.00
#10422Needs a look$58.00
#10423Paid$212.00
#10424Card declined$40.00
<div class="table-wrap">
  <table class="table" id="tbl-flash">
    <thead><tr><th>Order</th><th>Status</th><th class="num">Total</th></tr></thead>
    <tbody>
      <tr><td>#10421</td><td>Shipped</td><td class="num">$129.00</td></tr>
      <tr class="is-highlight"><td>#10422</td><td>Needs a look</td><td class="num">$58.00</td></tr>
      <tr class="row-green"><td>#10423</td><td>Paid</td><td class="num">$212.00</td></tr>
      <tr class="row-red"><td>#10424</td><td>Card declined</td><td class="num">$40.00</td></tr>
    </tbody>
  </table>
</div>
<button class="btn btn-sm mt-3" type="button" onclick="Momo.table.flash(document.querySelector('#tbl-flash tbody tr'))"><i class="mi mi-sparkles"></i> Flash the first row</button>

Sticky columns

In a wide table that scrolls sideways, .table-sticky-start keeps the first column in place and .table-sticky-end the last one (handy for actions). For another column, put .cell-sticky on its cells and set --sticky-start. Scroll the table below sideways.

ProductSKUColorSizeSupplierWarehouseStockPriceActions
Linen shirtLS-01SandMAtelier NordLisbon124$49.00
Canvas toteCT-07InkOneBag Co.Porto312$29.00
Wool beanieWB-12RustOneKnit HouseLisbon88$24.00
<div class="table-wrap">
  <table class="table table-sm table-sticky-start table-sticky-end table-head-fill" style="--table-width: 70rem">
    <thead><tr><th>Product</th><th>SKU</th><th>Color</th><th>Size</th><th>Supplier</th><th>Warehouse</th><th class="num">Stock</th><th class="num">Price</th><th><span class="visually-hidden">Actions</span></th></tr></thead>
    <tbody>
      <tr><td>Linen shirt</td><td>LS-01</td><td>Sand</td><td>M</td><td>Atelier Nord</td><td>Lisbon</td><td class="num">124</td><td class="num">$49.00</td><td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Linen shirt"><i class="mi mi-pencil"></i></button></div></td></tr>
      <tr><td>Canvas tote</td><td>CT-07</td><td>Ink</td><td>One</td><td>Bag Co.</td><td>Porto</td><td class="num">312</td><td class="num">$29.00</td><td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Canvas tote"><i class="mi mi-pencil"></i></button></div></td></tr>
      <tr><td>Wool beanie</td><td>WB-12</td><td>Rust</td><td>One</td><td>Knit House</td><td>Lisbon</td><td class="num">88</td><td class="num">$24.00</td><td><div class="cell-actions"><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Edit Wool beanie"><i class="mi mi-pencil"></i></button></div></td></tr>
    </tbody>
  </table>
</div>

Sticky header

.table-scroll on the wrap gives it a fixed height (--table-height, 24rem) with the header staying on top while you scroll.

Empty

NameRole
No people yet.
<div class="table-wrap">
  <table class="table">
    <thead><tr><th>Name</th><th>Role</th></tr></thead>
    <tbody><tr class="table-empty"><td colspan="2"><i class="mi mi-inbox"></i> No people yet.</td></tr></tbody>
  </table>
</div>

Sorting

For search, pages, rows that open, tree rows, groups and editing cells, see Data table.

Add data-momo-sort to the table: every header becomes a button (skip one with data-momo-nosort). Numbers, money, percents and dates sort by value. When the text is not the value, set data-sort on the cell (like data-sort="2020-04-30" for "30 Apr 2020").

table.addEventListener('momo:sort', (e) => console.log(e.detail.column, e.detail.direction));
Momo.table.sort(table, 4, 'descending');

Accessibility

Variables

VariableDefault
--table-pad-y / --table-pad-x.8rem / 1rem
--table-lineInk at 22% (row lines)
--table-height24rem (with .table-scroll)

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close