luxtable 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,39 @@ LuxTable is a high-performance, feature-rich data grid library designed specific
|
|
|
23
23
|
|
|
24
24
|
## 🚀 Quick Start
|
|
25
25
|
|
|
26
|
-
### Installation
|
|
26
|
+
### Installation (Recommended: shadcn CLI)
|
|
27
|
+
|
|
28
|
+
LuxTable uses the **shadcn registry** approach - components are copied directly into your project, giving you full control over the code.
|
|
29
|
+
|
|
30
|
+
#### Prerequisites
|
|
31
|
+
|
|
32
|
+
Make sure you have shadcn/ui set up in your project:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm dlx shadcn@latest init
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Install LuxTable
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install the main LuxTable component
|
|
42
|
+
pnpm dlx shadcn@latest add "https://luxtable.dev/r/lux-table.json"
|
|
43
|
+
|
|
44
|
+
# Optional: Install pre-built cell renderers
|
|
45
|
+
pnpm dlx shadcn@latest add "https://luxtable.dev/r/lux-table-cell-renderers.json"
|
|
46
|
+
|
|
47
|
+
# Optional: Install column helper utilities
|
|
48
|
+
pnpm dlx shadcn@latest add "https://luxtable.dev/r/lux-table-column-helper.json"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This will:
|
|
52
|
+
- Copy LuxTable components to your `components/lux-table` folder
|
|
53
|
+
- Install required dependencies (`@tanstack/react-table`, `lucide-react`)
|
|
54
|
+
- Install required shadcn/ui components (button, checkbox, dropdown-menu, input, select)
|
|
55
|
+
|
|
56
|
+
### Alternative: npm Package
|
|
57
|
+
|
|
58
|
+
If you prefer using LuxTable as an npm package:
|
|
27
59
|
|
|
28
60
|
```bash
|
|
29
61
|
npm install luxtable
|
|
@@ -33,10 +65,21 @@ pnpm add luxtable
|
|
|
33
65
|
yarn add luxtable
|
|
34
66
|
```
|
|
35
67
|
|
|
68
|
+
> **Note:** When using the npm package, you need to configure your `tailwind.config.js` to include LuxTable:
|
|
69
|
+
> ```js
|
|
70
|
+
> module.exports = {
|
|
71
|
+
> content: [
|
|
72
|
+
> "./src/**/*.{js,ts,jsx,tsx}",
|
|
73
|
+
> "./node_modules/luxtable/dist/**/*.{js,mjs}",
|
|
74
|
+
> ],
|
|
75
|
+
> };
|
|
76
|
+
> ```
|
|
77
|
+
|
|
36
78
|
### Basic Usage
|
|
37
79
|
|
|
38
80
|
```tsx
|
|
39
|
-
import { LuxTable
|
|
81
|
+
import { LuxTable } from "@/components/lux-table/lux-table";
|
|
82
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
40
83
|
|
|
41
84
|
type User = {
|
|
42
85
|
id: number;
|
|
@@ -45,21 +88,23 @@ type User = {
|
|
|
45
88
|
status: "active" | "inactive";
|
|
46
89
|
};
|
|
47
90
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
columnHelper.accessor("id", {
|
|
91
|
+
const columns: ColumnDef<User>[] = [
|
|
92
|
+
{
|
|
93
|
+
accessorKey: "id",
|
|
52
94
|
header: "ID",
|
|
53
|
-
}
|
|
54
|
-
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
accessorKey: "name",
|
|
55
98
|
header: "Name",
|
|
56
|
-
}
|
|
57
|
-
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
accessorKey: "email",
|
|
58
102
|
header: "Email",
|
|
59
|
-
}
|
|
60
|
-
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
accessorKey: "status",
|
|
61
106
|
header: "Status",
|
|
62
|
-
}
|
|
107
|
+
},
|
|
63
108
|
];
|
|
64
109
|
|
|
65
110
|
const data: User[] = [
|
|
@@ -73,10 +118,10 @@ export default function App() {
|
|
|
73
118
|
data={data}
|
|
74
119
|
columns={columns}
|
|
75
120
|
options={{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
121
|
+
pagination: true,
|
|
122
|
+
filtering: true,
|
|
123
|
+
selection: "multiple",
|
|
124
|
+
showToolbar: true,
|
|
80
125
|
}}
|
|
81
126
|
/>
|
|
82
127
|
);
|
|
@@ -88,49 +133,48 @@ export default function App() {
|
|
|
88
133
|
LuxTable comes with built-in cell renderers for common use cases:
|
|
89
134
|
|
|
90
135
|
```tsx
|
|
91
|
-
import {
|
|
92
|
-
StatusCell,
|
|
93
|
-
ProgressCell,
|
|
94
|
-
DateCell,
|
|
95
|
-
CopyableCell
|
|
96
|
-
} from "luxtable";
|
|
136
|
+
import { StatusCell, ProgressCell, DateCell, CopyableCell } from "@/components/lux-table/cell-renderers";
|
|
97
137
|
|
|
98
138
|
// Status badges
|
|
99
|
-
|
|
139
|
+
{
|
|
140
|
+
accessorKey: "status",
|
|
100
141
|
header: "Status",
|
|
101
|
-
cell: (
|
|
102
|
-
}
|
|
142
|
+
cell: ({ row }) => <StatusCell value={row.getValue("status")} />,
|
|
143
|
+
}
|
|
103
144
|
|
|
104
145
|
// Progress bars
|
|
105
|
-
|
|
146
|
+
{
|
|
147
|
+
accessorKey: "progress",
|
|
106
148
|
header: "Progress",
|
|
107
|
-
cell: (
|
|
108
|
-
}
|
|
149
|
+
cell: ({ row }) => <ProgressCell value={row.getValue("progress")} />,
|
|
150
|
+
}
|
|
109
151
|
|
|
110
152
|
// Formatted dates
|
|
111
|
-
|
|
153
|
+
{
|
|
154
|
+
accessorKey: "createdAt",
|
|
112
155
|
header: "Created",
|
|
113
|
-
cell: (
|
|
114
|
-
}
|
|
156
|
+
cell: ({ row }) => <DateCell value={row.getValue("createdAt")} />,
|
|
157
|
+
}
|
|
115
158
|
|
|
116
159
|
// Copy to clipboard
|
|
117
|
-
|
|
160
|
+
{
|
|
161
|
+
accessorKey: "id",
|
|
118
162
|
header: "ID",
|
|
119
|
-
cell: (
|
|
120
|
-
}
|
|
163
|
+
cell: ({ row }) => <CopyableCell value={row.getValue("id")} />,
|
|
164
|
+
}
|
|
121
165
|
```
|
|
122
166
|
|
|
123
167
|
## 🎯 Options
|
|
124
168
|
|
|
125
169
|
| Option | Type | Default | Description |
|
|
126
170
|
|--------|------|---------|-------------|
|
|
127
|
-
| `
|
|
128
|
-
| `enableColumnFilters` | `boolean` | `false` | Enable column-level filtering |
|
|
129
|
-
| `enableGlobalFilter` | `boolean` | `false` | Enable global search |
|
|
130
|
-
| `enableRowSelection` | `boolean` | `false` | Enable row selection with checkboxes |
|
|
131
|
-
| `enableSorting` | `boolean` | `true` | Enable column sorting |
|
|
132
|
-
| `showToolbar` | `boolean` | `false` | Show toolbar with search and column visibility |
|
|
171
|
+
| `pagination` | `boolean` | `false` | Enable/disable pagination |
|
|
133
172
|
| `pageSize` | `number` | `10` | Default rows per page |
|
|
173
|
+
| `filtering` | `boolean` | `false` | Enable column-level filtering |
|
|
174
|
+
| `selection` | `"single" \| "multiple" \| "none"` | `"none"` | Row selection mode |
|
|
175
|
+
| `showToolbar` | `boolean` | `false` | Show toolbar with search and column visibility |
|
|
176
|
+
| `showGlobalSearch` | `boolean` | `true` | Show global search in toolbar |
|
|
177
|
+
| `showColumnVisibility` | `boolean` | `true` | Show column visibility controls |
|
|
134
178
|
|
|
135
179
|
## 🛠 Tech Stack
|
|
136
180
|
|
|
@@ -147,6 +191,16 @@ Visit our [documentation](https://luxtable.dev/docs) for detailed guides and exa
|
|
|
147
191
|
|
|
148
192
|
Most data grids are either too lightweight for complex tasks or too bloated with legacy styles. LuxTable is built from the ground up to be **headless-first but styled-ready**. It provides the engine you need for heavy data work, wrapped in the minimalist aesthetic that modern users expect.
|
|
149
193
|
|
|
194
|
+
### Why shadcn Registry?
|
|
195
|
+
|
|
196
|
+
By using the shadcn registry approach instead of a traditional npm package:
|
|
197
|
+
|
|
198
|
+
- ✅ **Full Control** - Components are in your codebase, customize freely
|
|
199
|
+
- ✅ **No CSS Conflicts** - Uses your project's Tailwind configuration
|
|
200
|
+
- ✅ **Smaller Bundle** - Only include what you need
|
|
201
|
+
- ✅ **Easy Updates** - Re-run the add command to update
|
|
202
|
+
- ✅ **Matches Your Stack** - Works seamlessly with your existing shadcn/ui components
|
|
203
|
+
|
|
150
204
|
## 📄 License
|
|
151
205
|
|
|
152
206
|
MIT © [LuxTable](https://github.com/luxtable/luxtable)
|