Skip to main content

Table

A table displays structured data in rows and columns. Use it for small, static data sets. When users need to sort, search, filter or select, use DataTable instead.

Base
Mantine + override
Mantine
Import
{ Table } from '@mantine/core'
Source
src/themes/theme.ts
src/themes/style-overrides/table.module.css

Usage​

NavnRolleStatus
Ola NordmannProsjektlederAktiv
Kari NilsenIngeniørValgt
Per HansenKontrollørVenter
Mona BergArkitektAktiv
Jonas EideIngeniørAktiv
Silje AasKontrollørFerdig
striped
withTableBorder
withRowBorders
withColumnBorders
data-active
Sub-text
size
sm
md
lg
React
<Table>
<Table.Thead>
<Table.Tr>
<Table.Th>Navn</Table.Th>
<Table.Th>Rolle</Table.Th>
<Table.Th>Status</Table.Th>
</Table.Tr>
</Table.Thead>
<Table.Tbody>
<Table.Tr>
<Table.Td>Ola Nordmann</Table.Td>
<Table.Td>Prosjektleder</Table.Td>
<Table.Td>Aktiv</Table.Td>
</Table.Tr>
{/* data-active marks the selected row — ours, not Mantine's */}
<Table.Tr data-active>
<Table.Td>Kari Nilsen</Table.Td>
<Table.Td>Ingeniør</Table.Td>
<Table.Td>Valgt</Table.Td>
</Table.Tr>
<Table.Tr>
<Table.Td>Per Hansen</Table.Td>
<Table.Td>Kontrollør</Table.Td>
<Table.Td>Venter</Table.Td>
</Table.Tr>
<Table.Tr>
<Table.Td>Mona Berg</Table.Td>
<Table.Td>Arkitekt</Table.Td>
<Table.Td>Aktiv</Table.Td>
</Table.Tr>
<Table.Tr>
<Table.Td>Jonas Eide</Table.Td>
<Table.Td>Ingeniør</Table.Td>
<Table.Td>Aktiv</Table.Td>
</Table.Tr>
<Table.Tr>
<Table.Td>Silje Aas</Table.Td>
<Table.Td>Kontrollør</Table.Td>
<Table.Td>Ferdig</Table.Td>
</Table.Tr>
</Table.Tbody>
</Table>

Props​

Only what this design system changes or adds. Everything else is Mantine's — read the full props table there.

PropertyTypeAllowed valuesDefaultDescription
withTableBorderboolean—trueDraws a border around the table.
horizontalSpacing / verticalSpacingMantineSpacing—xsCell padding.
data-sizestringsm · md · lgsmSets the minimum row height.
data-active———Set on Table.Tr to mark a selected row.

Accessibility​

  • Build the table from Table.Thead, Table.Tbody, Table.Tr, Table.Th and Table.Td, not a hand-written table element.
  • The selected row is only shown visually. Add aria-selected when the selection must reach screen readers.

See Accessibility for the reasoning.