bootstrap-svelte-tanstack-table
v0.1.0
Published
A fully featured Bootstrap 5 implementation of TanStack Table V9 for Svelte 5, written from the ground up in TypeScript.
Maintainers
Readme
bootstrap-svelte-tanstack-table
A fully featured Bootstrap 5 data table for Svelte 5, built on TanStack Table v9. A port of Material React Table with a runes and snippets API.
Install
npm install bootstrap-svelte-tanstack-tableNeeds Svelte 5 and Bootstrap 5. Import the stylesheet after Bootstrap in your global CSS. It bridges the
library's tokens to Bootstrap's own CSS variables, so the table follows whatever theme/colors and color mode
(data-bs-theme) your app already has:
@import 'bootstrap/dist/css/bootstrap.css';
@import 'bootstrap-svelte-tanstack-table/styles.css';Usage
<script lang="ts">
import { BootstrapSvelteTable, type MRT_ColumnDef } from 'bootstrap-svelte-tanstack-table';
type Person = { name: string; age: number };
// define columns once, outside of any reactive code
const columns: MRT_ColumnDef<Person>[] = [
{ accessorKey: 'name', header: 'Name' },
{ accessorKey: 'age', header: 'Age' },
];
let data = $state<Person[]>([
{ name: 'John', age: 30 },
{ name: 'Sara', age: 25 },
]);
</script>
<BootstrapSvelteTable
options={{
columns,
// options that change over time are passed as getters
get data() {
return data;
},
enableRowSelection: true,
}}
/>Docs
The documentation site is in apps/bootstrap-tanstack-table-docs,
live at bootstrap-tanstack-table.pages.dev, with a
Storybook alongside it.
This package is one of six table libraries in the
svelte-tables repository.
License
MIT
