torch-glare 1.2.8 → 1.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/apps/lib/components/TableDnDWrapper.ts +495 -0
- package/apps/lib/components/TextEditor.tsx +53 -1
- package/dist/bin/index.js +5 -0
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/mcp.d.ts +2 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +91 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/shared/configureFonts.d.ts +6 -0
- package/dist/src/shared/configureFonts.d.ts.map +1 -0
- package/dist/src/shared/configureFonts.js +106 -0
- package/dist/src/shared/configureFonts.js.map +1 -0
- package/dist/src/shared/configureGlobalCss.d.ts +6 -0
- package/dist/src/shared/configureGlobalCss.d.ts.map +1 -0
- package/dist/src/shared/configureGlobalCss.js +154 -0
- package/dist/src/shared/configureGlobalCss.js.map +1 -0
- package/dist/src/shared/configureTailwind.d.ts +7 -0
- package/dist/src/shared/configureTailwind.d.ts.map +1 -0
- package/dist/src/shared/configureTailwind.js +163 -0
- package/dist/src/shared/configureTailwind.js.map +1 -0
- package/dist/src/shared/detectFramework.d.ts +23 -0
- package/dist/src/shared/detectFramework.d.ts.map +1 -0
- package/dist/src/shared/detectFramework.js +119 -0
- package/dist/src/shared/detectFramework.js.map +1 -0
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts.map +1 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +18 -2
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +1 -1
- package/dist/src/shared/installBaseUtils.d.ts +5 -0
- package/dist/src/shared/installBaseUtils.d.ts.map +1 -0
- package/dist/src/shared/installBaseUtils.js +79 -0
- package/dist/src/shared/installBaseUtils.js.map +1 -0
- package/dist/src/shared/resolveAliases.d.ts +24 -0
- package/dist/src/shared/resolveAliases.d.ts.map +1 -0
- package/dist/src/shared/resolveAliases.js +98 -0
- package/dist/src/shared/resolveAliases.js.map +1 -0
- package/docs/components/breadcrumb.md +955 -0
- package/docs/components/button-group.md +647 -0
- package/docs/components/text-editor.md +711 -0
- package/docs/components/toggle-button.md +640 -0
- package/docs/tutorials/getting-started.md +123 -431
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ description: Step-by-step guide to installing and using TORCH Glare Components L
|
|
|
4
4
|
category: Tutorial
|
|
5
5
|
difficulty: Beginner
|
|
6
6
|
duration: 15 minutes
|
|
7
|
-
tags: [getting-started, installation, setup, first-component]
|
|
7
|
+
tags: [getting-started, installation, setup, first-component, cli, tailwind]
|
|
8
8
|
related:
|
|
9
9
|
- Building Your First Form
|
|
10
10
|
- Theming Basics
|
|
@@ -17,11 +17,10 @@ Welcome to TORCH Glare! This tutorial will guide you through installing the libr
|
|
|
17
17
|
|
|
18
18
|
## What You'll Learn
|
|
19
19
|
|
|
20
|
-
- Installing TORCH Glare
|
|
21
|
-
-
|
|
22
|
-
-
|
|
20
|
+
- Installing TORCH Glare using the CLI
|
|
21
|
+
- Configuring Tailwind CSS with TORCH plugins
|
|
22
|
+
- Adding components to your project
|
|
23
23
|
- Creating your first components
|
|
24
|
-
- Understanding the design system
|
|
25
24
|
|
|
26
25
|
## Prerequisites
|
|
27
26
|
|
|
@@ -29,473 +28,193 @@ Before you begin, make sure you have:
|
|
|
29
28
|
|
|
30
29
|
- Node.js 16+ installed
|
|
31
30
|
- Basic knowledge of React and TypeScript
|
|
32
|
-
- A React project (Next.js, Vite, or Create React App)
|
|
31
|
+
- A React project with Tailwind CSS installed (Next.js, Vite, or Create React App)
|
|
33
32
|
|
|
34
33
|
---
|
|
35
34
|
|
|
36
|
-
## Step 1:
|
|
35
|
+
## Step 1: Initialize TORCH Glare
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
Run the following command to initialize your project:
|
|
39
38
|
|
|
40
39
|
```bash
|
|
41
|
-
|
|
40
|
+
npx torch-glare@latest init
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
This will install the required dependencies and generate a `glare.json` file, where you can customize the installation path for your components.
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
### Configure Component Path
|
|
46
|
+
|
|
47
|
+
The generated `glare.json` file controls where components are installed:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"path": "./src"
|
|
52
|
+
}
|
|
48
53
|
```
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
Adjust the `path` to match your project structure (e.g., `./src`, `./app`, `./components`).
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
---
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
npm install mapping-color-system glare-torch-mode glare-typography tailwindcss-animate tailwind-scrollbar-hide
|
|
56
|
-
```
|
|
59
|
+
## Step 2: Add Fonts and Icons
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
Add Remix Icons CDN and SF-Pro font to your HTML `<head>` or metadata. SF-Pro is the standard font family for TORCH Glare Components.
|
|
59
62
|
|
|
60
|
-
```
|
|
61
|
-
|
|
63
|
+
```html
|
|
64
|
+
<head>
|
|
65
|
+
<link
|
|
66
|
+
href="https://cdn.jsdelivr.net/npm/remixicon@4.5.0/fonts/remixicon.css"
|
|
67
|
+
rel="stylesheet"
|
|
68
|
+
/>
|
|
69
|
+
<link
|
|
70
|
+
rel="stylesheet"
|
|
71
|
+
href="https://cdn.statically.io/gh/TORCH-Corp/SF-PRO-FONT/main/font/fonts.css"
|
|
72
|
+
/>
|
|
73
|
+
<link
|
|
74
|
+
rel="preload"
|
|
75
|
+
href="https://cdn.statically.io/gh/TORCH-Corp/SF-PRO-FONT/main/font/SF-Pro.woff2"
|
|
76
|
+
as="font"
|
|
77
|
+
type="font/woff2"
|
|
78
|
+
/>
|
|
79
|
+
</head>
|
|
62
80
|
```
|
|
63
81
|
|
|
64
82
|
---
|
|
65
83
|
|
|
66
|
-
## Step
|
|
67
|
-
|
|
68
|
-
Create or update your `tailwind.config.ts` file:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
// tailwind.config.ts
|
|
72
|
-
import type { Config } from "tailwindcss";
|
|
73
|
-
|
|
74
|
-
export default {
|
|
75
|
-
content: [
|
|
76
|
-
"./app/**/*.{js,ts,jsx,tsx}",
|
|
77
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
78
|
-
"./components/**/*.{js,ts,jsx,tsx}",
|
|
79
|
-
],
|
|
80
|
-
theme: {
|
|
81
|
-
extend: {},
|
|
82
|
-
},
|
|
83
|
-
plugins: [
|
|
84
|
-
// TORCH Glare required plugins
|
|
85
|
-
require('mapping-color-system'),
|
|
86
|
-
require('glare-torch-mode'),
|
|
87
|
-
require('glare-typography'),
|
|
88
|
-
|
|
89
|
-
// Optional but recommended
|
|
90
|
-
require('tailwindcss-animate'),
|
|
91
|
-
require('tailwind-scrollbar-hide'),
|
|
92
|
-
],
|
|
93
|
-
} satisfies Config;
|
|
94
|
-
```
|
|
84
|
+
## Step 3: Configure Tailwind CSS
|
|
95
85
|
|
|
96
|
-
###
|
|
86
|
+
### For Tailwind CSS v4
|
|
97
87
|
|
|
98
|
-
|
|
99
|
-
// postcss.config.js
|
|
100
|
-
module.exports = {
|
|
101
|
-
plugins: {
|
|
102
|
-
tailwindcss: {},
|
|
103
|
-
autoprefixer: {},
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Import Tailwind CSS
|
|
88
|
+
Add the following to your `global.css` file:
|
|
109
89
|
|
|
110
90
|
```css
|
|
111
|
-
|
|
112
|
-
@
|
|
113
|
-
@tailwind
|
|
114
|
-
@
|
|
91
|
+
@import "tailwindcss";
|
|
92
|
+
@plugin "glare-torch-mode";
|
|
93
|
+
@plugin "tailwind-scrollbar-hide";
|
|
94
|
+
@plugin "tailwindcss-animate";
|
|
95
|
+
@plugin "glare-typography";
|
|
96
|
+
@plugin "mapping-color-system-v4";
|
|
97
|
+
@import "mapping-color-system-v4/tailwindVars.css";
|
|
115
98
|
```
|
|
116
99
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
## Step 3: Set Up Theme Provider
|
|
100
|
+
### For Tailwind CSS v3
|
|
120
101
|
|
|
121
|
-
|
|
102
|
+
First install the mapping color system:
|
|
122
103
|
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
import { ThemeProvider } from '@torch-ai/torch-glare';
|
|
126
|
-
import './globals.css';
|
|
127
|
-
|
|
128
|
-
export default function RootLayout({
|
|
129
|
-
children,
|
|
130
|
-
}: {
|
|
131
|
-
children: React.ReactNode;
|
|
132
|
-
}) {
|
|
133
|
-
return (
|
|
134
|
-
<html lang="en">
|
|
135
|
-
<body>
|
|
136
|
-
<ThemeProvider defaultTheme="light" defaultThemeMode="TORCH">
|
|
137
|
-
{children}
|
|
138
|
-
</ThemeProvider>
|
|
139
|
-
</body>
|
|
140
|
-
</html>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
104
|
+
```bash
|
|
105
|
+
npm install mapping-color-system@latest
|
|
143
106
|
```
|
|
144
107
|
|
|
145
|
-
|
|
108
|
+
Then configure your `tailwind.config.js`:
|
|
146
109
|
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
import { ThemeProvider } from '@torch-ai/torch-glare';
|
|
150
|
-
import type { AppProps } from 'next/app';
|
|
151
|
-
import '../styles/globals.css';
|
|
110
|
+
```js
|
|
111
|
+
const { plugin, mappingVars } = require('mapping-color-system')
|
|
152
112
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
113
|
+
module.exports = {
|
|
114
|
+
content: [
|
|
115
|
+
// put the path from your glare.json file, e.g.:
|
|
116
|
+
"./src/**/*.{js,ts,jsx,tsx,mdx}",
|
|
117
|
+
],
|
|
118
|
+
theme: {
|
|
119
|
+
extend: {
|
|
120
|
+
colors: mappingVars,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
plugins: [
|
|
124
|
+
plugin,
|
|
125
|
+
require('tailwindcss-animate'),
|
|
126
|
+
require('tailwind-scrollbar-hide'),
|
|
127
|
+
require('glare-typography'),
|
|
128
|
+
require('glare-torch-mode'),
|
|
129
|
+
function ({ addVariant }) {
|
|
130
|
+
addVariant("rtl", '&[dir="rtl"]');
|
|
131
|
+
addVariant("ltr", '&[dir="ltr"]');
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
160
135
|
```
|
|
161
136
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
import React from 'react';
|
|
167
|
-
import ReactDOM from 'react-dom/client';
|
|
168
|
-
import { ThemeProvider } from '@torch-ai/torch-glare';
|
|
169
|
-
import App from './App';
|
|
170
|
-
import './index.css';
|
|
171
|
-
|
|
172
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
173
|
-
<React.StrictMode>
|
|
174
|
-
<ThemeProvider defaultTheme="light" defaultThemeMode="TORCH">
|
|
175
|
-
<App />
|
|
176
|
-
</ThemeProvider>
|
|
177
|
-
</React.StrictMode>
|
|
178
|
-
);
|
|
179
|
-
```
|
|
137
|
+
Important:
|
|
138
|
+
- Specify the component path in the `content` array matching your `glare.json` path
|
|
139
|
+
- Add all plugins to the `plugins` array
|
|
140
|
+
- Add `mappingVars` to the `extend.colors` object
|
|
180
141
|
|
|
181
142
|
---
|
|
182
143
|
|
|
183
|
-
## Step 4:
|
|
144
|
+
## Step 4: Add Components
|
|
184
145
|
|
|
185
|
-
|
|
146
|
+
Run the following command to see a dropdown list of available components:
|
|
186
147
|
|
|
187
|
-
|
|
148
|
+
```bash
|
|
149
|
+
npx torch-glare@latest add
|
|
150
|
+
```
|
|
188
151
|
|
|
189
|
-
|
|
190
|
-
// components/WelcomeCard.tsx
|
|
191
|
-
import { Button } from '@torch-ai/torch-glare';
|
|
152
|
+
Or specify which component you want:
|
|
192
153
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
<div className="
|
|
196
|
-
bg-background-presentation-form-base
|
|
197
|
-
border border-border-presentation-global-primary
|
|
198
|
-
rounded-lg p-6 max-w-md
|
|
199
|
-
">
|
|
200
|
-
<h1 className="typography-display-medium-bold mb-2">
|
|
201
|
-
Welcome to TORCH Glare! 👋
|
|
202
|
-
</h1>
|
|
203
|
-
<p className="typography-body-medium-regular text-content-presentation-global-secondary mb-4">
|
|
204
|
-
You've successfully set up TORCH Glare. Let's build something amazing!
|
|
205
|
-
</p>
|
|
206
|
-
<Button theme="light" variant="PrimeStyle">
|
|
207
|
-
Get Started
|
|
208
|
-
</Button>
|
|
209
|
-
</div>
|
|
210
|
-
);
|
|
211
|
-
}
|
|
154
|
+
```bash
|
|
155
|
+
npx torch-glare@latest add Button
|
|
212
156
|
```
|
|
213
157
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
```tsx
|
|
217
|
-
// app/page.tsx or src/App.tsx
|
|
218
|
-
import WelcomeCard from './components/WelcomeCard';
|
|
158
|
+
You can add multiple components at once:
|
|
219
159
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
<div className="min-h-screen flex items-center justify-center p-4">
|
|
223
|
-
<WelcomeCard />
|
|
224
|
-
</div>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
160
|
+
```bash
|
|
161
|
+
npx torch-glare@latest add Button Input Badge
|
|
227
162
|
```
|
|
228
163
|
|
|
229
164
|
---
|
|
230
165
|
|
|
231
|
-
## Step 5:
|
|
232
|
-
|
|
233
|
-
Let's add a theme switcher to test the theming system.
|
|
166
|
+
## Step 5: Use Components
|
|
234
167
|
|
|
235
|
-
|
|
168
|
+
Import and use the components from the path configured in `glare.json`:
|
|
236
169
|
|
|
237
170
|
```tsx
|
|
238
|
-
|
|
239
|
-
'use client'; // Add this for Next.js App Router
|
|
240
|
-
|
|
241
|
-
import { useTheme, Button } from '@torch-ai/torch-glare';
|
|
242
|
-
|
|
243
|
-
export default function ThemeToggle() {
|
|
244
|
-
const { theme, updateTheme } = useTheme();
|
|
245
|
-
|
|
246
|
-
const toggleTheme = () => {
|
|
247
|
-
updateTheme(theme === 'light' ? 'dark' : 'light');
|
|
248
|
-
};
|
|
171
|
+
import { Button } from "./components/Button";
|
|
249
172
|
|
|
173
|
+
function App() {
|
|
250
174
|
return (
|
|
251
|
-
<Button
|
|
252
|
-
|
|
253
|
-
variant="ContStyle"
|
|
254
|
-
onClick={toggleTheme}
|
|
255
|
-
buttonType="icon"
|
|
256
|
-
size="M"
|
|
257
|
-
>
|
|
258
|
-
{theme === 'light' ? '🌙' : '☀️'}
|
|
175
|
+
<Button variant="PrimeStyle" size="M">
|
|
176
|
+
Click Me
|
|
259
177
|
</Button>
|
|
260
178
|
);
|
|
261
179
|
}
|
|
262
180
|
```
|
|
263
181
|
|
|
264
|
-
### Add to Layout
|
|
265
|
-
|
|
266
|
-
```tsx
|
|
267
|
-
// app/layout.tsx (or wherever your layout is)
|
|
268
|
-
import ThemeToggle from './components/ThemeToggle';
|
|
269
|
-
|
|
270
|
-
export default function RootLayout({
|
|
271
|
-
children,
|
|
272
|
-
}: {
|
|
273
|
-
children: React.ReactNode;
|
|
274
|
-
}) {
|
|
275
|
-
return (
|
|
276
|
-
<html lang="en">
|
|
277
|
-
<body>
|
|
278
|
-
<ThemeProvider defaultTheme="light" defaultThemeMode="TORCH">
|
|
279
|
-
<div className="fixed top-4 right-4 z-50">
|
|
280
|
-
<ThemeToggle />
|
|
281
|
-
</div>
|
|
282
|
-
{children}
|
|
283
|
-
</ThemeProvider>
|
|
284
|
-
</body>
|
|
285
|
-
</html>
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## Step 6: Explore More Components
|
|
293
|
-
|
|
294
|
-
Now that you have the basics set up, let's try a few more components.
|
|
295
|
-
|
|
296
182
|
### Button Variants
|
|
297
183
|
|
|
298
184
|
```tsx
|
|
299
|
-
import { Button } from
|
|
185
|
+
import { Button } from "./components/Button";
|
|
300
186
|
|
|
301
187
|
export default function ButtonShowcase() {
|
|
302
188
|
return (
|
|
303
189
|
<div className="flex gap-2 flex-wrap">
|
|
304
|
-
<Button
|
|
305
|
-
|
|
306
|
-
</Button>
|
|
307
|
-
<Button
|
|
308
|
-
Contrast
|
|
309
|
-
</Button>
|
|
310
|
-
<Button theme="light" variant="SecondStyle">
|
|
311
|
-
Secondary
|
|
312
|
-
</Button>
|
|
313
|
-
<Button theme="light" variant="BorderStyle">
|
|
314
|
-
Outline
|
|
315
|
-
</Button>
|
|
190
|
+
<Button variant="PrimeStyle">Primary</Button>
|
|
191
|
+
<Button variant="ContStyle">Contrast</Button>
|
|
192
|
+
<Button variant="SecondStyle">Secondary</Button>
|
|
193
|
+
<Button variant="BorderStyle">Outline</Button>
|
|
316
194
|
</div>
|
|
317
195
|
);
|
|
318
196
|
}
|
|
319
197
|
```
|
|
320
198
|
|
|
321
|
-
###
|
|
322
|
-
|
|
323
|
-
```tsx
|
|
324
|
-
import { InputField } from '@torch-ai/torch-glare';
|
|
325
|
-
import { useState } from 'react';
|
|
326
|
-
|
|
327
|
-
export default function InputDemo() {
|
|
328
|
-
const [email, setEmail] = useState('');
|
|
199
|
+
### Theming
|
|
329
200
|
|
|
330
|
-
|
|
331
|
-
<InputField
|
|
332
|
-
theme="light"
|
|
333
|
-
label="Email Address"
|
|
334
|
-
type="email"
|
|
335
|
-
value={email}
|
|
336
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
337
|
-
placeholder="you@example.com"
|
|
338
|
-
/>
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### Badge Component
|
|
201
|
+
Most components accept a `theme` prop for per-component theming:
|
|
344
202
|
|
|
345
203
|
```tsx
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
export default function BadgeDemo() {
|
|
349
|
-
return (
|
|
350
|
-
<div className="flex gap-2">
|
|
351
|
-
<Badge theme="light" variant="SecondStyle">
|
|
352
|
-
New
|
|
353
|
-
</Badge>
|
|
354
|
-
<Badge theme="light" variant="PrimeStyle">
|
|
355
|
-
Featured
|
|
356
|
-
</Badge>
|
|
357
|
-
<Badge theme="light" variant="ContStyle">
|
|
358
|
-
Popular
|
|
359
|
-
</Badge>
|
|
360
|
-
</div>
|
|
361
|
-
);
|
|
362
|
-
}
|
|
204
|
+
<Button theme="light" variant="PrimeStyle">Light Theme</Button>
|
|
205
|
+
<Button theme="dark" variant="PrimeStyle">Dark Theme</Button>
|
|
363
206
|
```
|
|
364
207
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
## Step 7: Understanding the Design System
|
|
368
|
-
|
|
369
|
-
### Color System
|
|
370
|
-
|
|
371
|
-
TORCH Glare uses a comprehensive color token system:
|
|
208
|
+
Or use the `ThemeProvider` for app-wide theming:
|
|
372
209
|
|
|
373
210
|
```tsx
|
|
374
|
-
|
|
375
|
-
<div className="bg-background-system-body-primary">
|
|
376
|
-
<div className="bg-background-presentation-form-base">
|
|
377
|
-
<div className="bg-background-presentation-action-primary">
|
|
378
|
-
|
|
379
|
-
// Text colors
|
|
380
|
-
<p className="text-content-presentation-global-primary">
|
|
381
|
-
<p className="text-content-presentation-global-secondary">
|
|
382
|
-
<p className="text-content-presentation-state-success">
|
|
383
|
-
|
|
384
|
-
// Border colors
|
|
385
|
-
<div className="border border-border-presentation-global-primary">
|
|
386
|
-
<div className="border border-border-presentation-action-hover">
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### Typography System
|
|
390
|
-
|
|
391
|
-
```tsx
|
|
392
|
-
// Display text (large headings)
|
|
393
|
-
<h1 className="typography-display-large-bold">
|
|
394
|
-
|
|
395
|
-
// Headers (section titles)
|
|
396
|
-
<h2 className="typography-headers-large-semibold">
|
|
397
|
-
|
|
398
|
-
// Body text (paragraphs)
|
|
399
|
-
<p className="typography-body-medium-regular">
|
|
400
|
-
|
|
401
|
-
// Labels (form labels, tags)
|
|
402
|
-
<label className="typography-labels-medium-semibold">
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
### Theme Props
|
|
406
|
-
|
|
407
|
-
Most components accept a `theme` prop:
|
|
408
|
-
|
|
409
|
-
```tsx
|
|
410
|
-
<Button theme="light" variant="PrimeStyle">
|
|
411
|
-
Light Theme
|
|
412
|
-
</Button>
|
|
413
|
-
|
|
414
|
-
<Button theme="dark" variant="PrimeStyle">
|
|
415
|
-
Dark Theme
|
|
416
|
-
</Button>
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
---
|
|
420
|
-
|
|
421
|
-
## Step 8: Build a Complete Example
|
|
422
|
-
|
|
423
|
-
Let's combine everything into a complete example:
|
|
424
|
-
|
|
425
|
-
```tsx
|
|
426
|
-
// components/UserProfile.tsx
|
|
427
|
-
'use client';
|
|
428
|
-
|
|
429
|
-
import { useState } from 'react';
|
|
430
|
-
import {
|
|
431
|
-
Button,
|
|
432
|
-
InputField,
|
|
433
|
-
Badge,
|
|
434
|
-
Avatar,
|
|
435
|
-
} from '@torch-ai/torch-glare';
|
|
436
|
-
|
|
437
|
-
export default function UserProfile() {
|
|
438
|
-
const [name, setName] = useState('');
|
|
439
|
-
const [email, setEmail] = useState('');
|
|
440
|
-
|
|
441
|
-
const handleSave = () => {
|
|
442
|
-
console.log('Saving:', { name, email });
|
|
443
|
-
};
|
|
211
|
+
import { ThemeProvider } from "./providers/ThemeProvider";
|
|
444
212
|
|
|
213
|
+
export default function RootLayout({ children }) {
|
|
445
214
|
return (
|
|
446
|
-
<
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
border border-border-presentation-global-primary
|
|
450
|
-
rounded-lg
|
|
451
|
-
">
|
|
452
|
-
{/* Header */}
|
|
453
|
-
<div className="flex items-center gap-4 mb-6">
|
|
454
|
-
<Avatar
|
|
455
|
-
theme="light"
|
|
456
|
-
src="/avatar.jpg"
|
|
457
|
-
alt="User"
|
|
458
|
-
size="L"
|
|
459
|
-
/>
|
|
460
|
-
<div>
|
|
461
|
-
<h2 className="typography-headers-large-bold">
|
|
462
|
-
Profile Settings
|
|
463
|
-
</h2>
|
|
464
|
-
<Badge theme="light" variant="SecondStyle">
|
|
465
|
-
Pro Member
|
|
466
|
-
</Badge>
|
|
467
|
-
</div>
|
|
468
|
-
</div>
|
|
469
|
-
|
|
470
|
-
{/* Form */}
|
|
471
|
-
<div className="space-y-4">
|
|
472
|
-
<InputField
|
|
473
|
-
theme="light"
|
|
474
|
-
label="Full Name"
|
|
475
|
-
value={name}
|
|
476
|
-
onChange={(e) => setName(e.target.value)}
|
|
477
|
-
placeholder="Enter your name"
|
|
478
|
-
/>
|
|
479
|
-
|
|
480
|
-
<InputField
|
|
481
|
-
theme="light"
|
|
482
|
-
label="Email Address"
|
|
483
|
-
type="email"
|
|
484
|
-
value={email}
|
|
485
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
486
|
-
placeholder="you@example.com"
|
|
487
|
-
/>
|
|
488
|
-
|
|
489
|
-
<div className="flex gap-2 justify-end">
|
|
490
|
-
<Button theme="light" variant="BorderStyle">
|
|
491
|
-
Cancel
|
|
492
|
-
</Button>
|
|
493
|
-
<Button theme="light" variant="PrimeStyle" onClick={handleSave}>
|
|
494
|
-
Save Changes
|
|
495
|
-
</Button>
|
|
496
|
-
</div>
|
|
497
|
-
</div>
|
|
498
|
-
</div>
|
|
215
|
+
<ThemeProvider defaultTheme="light">
|
|
216
|
+
{children}
|
|
217
|
+
</ThemeProvider>
|
|
499
218
|
);
|
|
500
219
|
}
|
|
501
220
|
```
|
|
@@ -504,56 +223,29 @@ export default function UserProfile() {
|
|
|
504
223
|
|
|
505
224
|
## Common Issues and Solutions
|
|
506
225
|
|
|
507
|
-
###
|
|
226
|
+
### Styles Not Applied
|
|
508
227
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
**Solution**: Make sure you've:
|
|
228
|
+
Make sure you've:
|
|
512
229
|
1. Imported `globals.css` with Tailwind directives
|
|
513
|
-
2. Configured `tailwind.config
|
|
514
|
-
3. Added
|
|
515
|
-
|
|
516
|
-
### Issue: Theme Not Switching
|
|
230
|
+
2. Configured `tailwind.config` correctly with all plugins
|
|
231
|
+
3. Added the correct component path to the `content` array
|
|
517
232
|
|
|
518
|
-
|
|
233
|
+
### Theme Not Switching
|
|
519
234
|
|
|
520
|
-
|
|
235
|
+
Ensure:
|
|
521
236
|
1. `ThemeProvider` wraps your app
|
|
522
|
-
2. Component is marked with `'use client'` (Next.js)
|
|
237
|
+
2. Component is marked with `'use client'` (Next.js App Router)
|
|
523
238
|
3. Both `mapping-color-system` and `glare-torch-mode` plugins are installed
|
|
524
239
|
|
|
525
|
-
|
|
240
|
+
---
|
|
526
241
|
|
|
527
|
-
|
|
242
|
+
## Manual Installation
|
|
528
243
|
|
|
529
|
-
|
|
530
|
-
```bash
|
|
531
|
-
npm install --save-dev @types/react @types/node
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
---
|
|
244
|
+
If you have issues with the CLI, see the [manual installation guide](https://torch-glare.com/getting-started/manual) for step-by-step instructions.
|
|
535
245
|
|
|
536
246
|
## Next Steps
|
|
537
247
|
|
|
538
|
-
Congratulations! You've successfully set up TORCH Glare. Here's what to explore next:
|
|
539
|
-
|
|
540
248
|
1. **[Building Your First Form](./building-first-form.md)** - Create a complete form with validation
|
|
541
249
|
2. **[Theming Basics](./theming-basics.md)** - Customize colors and themes
|
|
542
250
|
3. **[Component Composition](./component-composition.md)** - Build complex UIs
|
|
543
251
|
4. **[Component Documentation](../components/)** - Explore all available components
|
|
544
|
-
|
|
545
|
-
## Additional Resources
|
|
546
|
-
|
|
547
|
-
- [GitHub Repository](https://github.com/torch-ai/torch-glare)
|
|
548
|
-
- [Component API Reference](../components/)
|
|
549
|
-
- [Tailwind Plugins Reference](../reference/tailwind-plugins.md)
|
|
550
|
-
- [Hooks Reference](../reference/hooks.md)
|
|
551
|
-
|
|
552
|
-
## Need Help?
|
|
553
|
-
|
|
554
|
-
- Check the [FAQ](../faq.md)
|
|
555
|
-
- Read [Common Issues](../troubleshooting.md)
|
|
556
|
-
- Join our [Discord Community](https://discord.gg/torch-glare)
|
|
557
|
-
- Report issues on [GitHub](https://github.com/torch-ai/torch-glare/issues)
|
|
558
|
-
|
|
559
|
-
Happy coding! 🚀
|