File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change 1
- <h1 align =" center " >svelte-data-table</ h1 >
1
+ <img align =" center " alt = " Svelte Data Table Screenshot " src = " https://github.com/user-attachments/assets/fc527332-882b-463a-b070-d4714b32ec47 " >
2
2
3
- < p align = " center " >Small, fast data table library with client-side sorting, filtering, and pagination.</ p >
3
+ ---
4
4
5
5
- No dependencies
6
6
- TypeScript
7
7
- Supports SvelteKit, SSR, Svelte 5
8
+ - Works great with shadcn [ Data Table] ( https://www.shadcn-svelte.com/docs/components/data-table )
9
+
10
+ ## Demo
11
+
12
+ ** [ Demo Website] ( https://careswitch-svelte-data-table.vercel.app ) **
8
13
9
14
## Installation
10
15
11
16
``` bash
12
17
npm install @careswitch/svelte-data-table
13
18
```
14
19
20
+ _ Requires Svelte 5 peer dependency_
21
+
15
22
## Usage
16
23
17
24
``` svelte
@@ -26,8 +33,31 @@ npm install @careswitch/svelte-data-table
26
33
columns: [
27
34
{ key: 'id', name: 'ID' },
28
35
{ key: 'name', name: 'Name' },
29
- { key: 'status', name: 'Status', sortable: false }
36
+ { key: 'status', name: 'Status' }
30
37
]
31
38
});
32
39
</script>
40
+
41
+ <table>
42
+ <thead>
43
+ <tr>
44
+ {#each table.columns as column (column.key)}
45
+ <th>{column.name}</th>
46
+ {/each}
47
+ </tr>
48
+ </thead>
49
+ <tbody>
50
+ {#each table.rows as row (row.id)}
51
+ <tr>
52
+ {#each table.columns as column (column.key)}
53
+ <td>{row[column.key]}</td>
54
+ {/each}
55
+ </tr>
56
+ {/each}
57
+ </tbody>
58
+ </table>
33
59
```
60
+
61
+ ## Examples
62
+
63
+ Reference the demo website [ +page.svelte] ( ./src/routes/+page.svelte ) for a more comprehensive example.
You can’t perform that action at this time.
0 commit comments