Table

A flexible component for displaying tabular data with customizable cell rendering using Svelte snippets.

Samples

Standard Table

A basic table with header, body, and footer.

User Directory
IDNameAge
1Alice30
2Bob24
3Charlie35
Total3 Users

0

<Table 

1

  caption="User Directory"

2

  tableHeadItems={['ID', 'Name']}

3

  tableRowItems={[[1, 'Alice'], [2, 'Bob']]}

4

  tableFooterItems={['Total', '2']}

5

>

6

  {#snippet headTemplate(item)} {item} {/snippet}

7

  {#snippet bodyTemplate(item)} {item} {/snippet}

8

  {#snippet footerTemplate(item)} <strong>{item}</strong> {/snippet}

9

</Table>

Styled Table

Applying custom classes to specific table sections.

IDNameAge
1Alice30
2Bob24
3Charlie35

0

<Table 

1

  tableHeadItems={headers} 

2

  tableRowItems={users}

3

  headClass="bg-primary-500 text-white"

4

  rowClass="hover:bg-neutral-100"

5

>

6

  ...

7

</Table>