Shadcn React Table

Search documentation

Search the docs

Localization

The table ships in 38 languages. English is built in, and each of the other 37 is an optional registry item you install only when you need it. Every user-facing string can also be overridden one by one with the localization option.

LocalizationOverride the string table (Spanish).
GitHub
ID
2261
45000134754
099
AvaThompsonOwnerEngineeringactive22$45,000Jan 2, 2023
0%
LiamNguyenAdminMarketinginactive25$47,137Jan 13, 2023
9%
NoahSilvaEditorDesignpending28$49,274Jan 24, 2023
18%
EmmaCarterViewerSalesactive31$51,411Feb 4, 2023
27%
OliviaRossiOwnerSupportinactive34$53,548Feb 15, 2023
36%
WilliamWalkerAdminEngineeringpending37$55,685Feb 26, 2023
45%
SophiaPatelEditorMarketingactive40$57,822Mar 9, 2023
54%
JamesMullerViewerDesigninactive43$59,959Mar 20, 2023
63%
IsabellaParkOwnerSalespending46$62,096Mar 31, 2023
72%
LucasReyesAdminSupportactive49$64,233Apr 11, 2023
81%
$4,120,536
Filas por página
1–10 de 48

Install a language

Add the language after the table. Each one is its own registry item, named data-table-locale-<code>:

bash
pnpm dlx shadcn@latest add https://monabbir-ahmmad.github.io/shadcn-react-table/r/data-table-locale-de.json

It writes one file, components/ui/data-table/locales/de.ts, and adds no npm packages. Install as many languages as you like.

Use it on one table

tsx
import { DataTable, useDataTable } from "@/components/ui/data-table"
import { dataTableLocalizationDe } from "@/components/ui/data-table/locales/de"

const table = useDataTable({
  data,
  columns,
  getRowId: (row) => row.id,
  localization: dataTableLocalizationDe,
})

return <DataTable table={table} />

Use it app-wide

To set the language for many tables at once, wrap a subtree in DataTableConfigProvider. A localization option on a single table still overrides the provider.

tsx
import { DataTableConfigProvider } from "@/components/ui/data-table"
import { dataTableLocalizationDe } from "@/components/ui/data-table/locales/de"

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <DataTableConfigProvider localization={dataTableLocalizationDe}>
      {children}
    </DataTableConfigProvider>
  )
}
App-wide configDataTableConfigProvider sets strings and icons for every table.
GitHub
ID
AvaThompsonOwnerEngineeringactive22$45,000Jan 2, 2023
0%
LiamNguyenAdminMarketinginactive25$47,137Jan 13, 2023
9%
NoahSilvaEditorDesignpending28$49,274Jan 24, 2023
18%
EmmaCarterViewerSalesactive31$51,411Feb 4, 2023
27%
OliviaRossiOwnerSupportinactive34$53,548Feb 15, 2023
36%
$4,120,536
Rows per page
1–5 of 48

Change single strings

A language is a plain object, so spread it and replace only the keys you want. Define the object outside the component: a new object on every render rebuilds the columns.

tsx
const localization = {
  ...dataTableLocalizationDe,
  rowsPerPage: "Einträge pro Seite",
}

function PeopleTable() {
  const table = useDataTable({ data, columns, localization })
  return <DataTable table={table} />
}

Partial overrides

Without a language file you only need the keys you want to change — everything else falls back to the built-in English. Function-valued entries, such as paginationRange: (start, end, total) => ..., build a label from the current values.

Numbers and dates

Dates follow the localization's language: date filters and the date picker show dates, month names and weekday names in that language, always in the Gregorian calendar. Every language file sets language for you. If you write your own localization, set language to a BCP 47 tag such as "es".

Numbers do not follow language. Each language file formats its own numbers inside its function keys (for example 1,000 in English and 1.000 in German). A custom localization that only sets language keeps English number formatting, so call toLocaleString with your tag in the function keys yourself:

tsx
rowsSelected: (selected, total) =>
  `${selected.toLocaleString("es")} de ${total.toLocaleString("es")} filas seleccionadas`,

Numbers and dates come from the runtime's Intl data, so the server and the browser can differ slightly for some languages.

Available languages

LanguageCodeExport
English (built in)endefaultLocalization
ArabicardataTableLocalizationAr
AzerbaijaniazdataTableLocalizationAz
BulgarianbgdataTableLocalizationBg
CzechcsdataTableLocalizationCs
DanishdadataTableLocalizationDa
GermandedataTableLocalizationDe
GreekeldataTableLocalizationEl
SpanishesdataTableLocalizationEs
EstonianetdataTableLocalizationEt
PersianfadataTableLocalizationFa
FinnishfidataTableLocalizationFi
FrenchfrdataTableLocalizationFr
HebrewhedataTableLocalizationHe
CroatianhrdataTableLocalizationHr
HungarianhudataTableLocalizationHu
ArmenianhydataTableLocalizationHy
IndonesianiddataTableLocalizationId
ItalianitdataTableLocalizationIt
JapanesejadataTableLocalizationJa
KoreankodataTableLocalizationKo
NepalinedataTableLocalizationNe
DutchnldataTableLocalizationNl
NorwegiannodataTableLocalizationNo
PolishpldataTableLocalizationPl
PortugueseptdataTableLocalizationPt
Portuguese (Brazil)pt-BRdataTableLocalizationPtBR
RomanianrodataTableLocalizationRo
RussianrudataTableLocalizationRu
SlovakskdataTableLocalizationSk
Serbian (Cyrillic)sr-Cyrl-RSdataTableLocalizationSrCyrlRS
Serbian (Latin)sr-Latn-RSdataTableLocalizationSrLatnRS
SwedishsvdataTableLocalizationSv
TurkishtrdataTableLocalizationTr
UkrainianukdataTableLocalizationUk
VietnamesevidataTableLocalizationVi
Chinese (Simplified)zh-HansdataTableLocalizationZhHans
Chinese (Traditional)zh-HantdataTableLocalizationZhHant

Translation quality

The translations are adapted from Material React Table (MIT License, Copyright (c) 2022 Kevin Vandy). Strings that Material React Table does not have were added here, and those lines are marked // needs review in the file: a native speaker has not checked them yet.

To fix one, edit the file in your project (it is your copy) and delete the comment. To fix it for everyone, send a pull request against the matching file under packages/shadcn-react-table/src/components/data-table/locales/.