@tinybigui/react 0.3.0 → 0.4.1

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 CHANGED
@@ -60,16 +60,30 @@ This library requires React 18 or higher:
60
60
 
61
61
  ## 🚀 Quick Start
62
62
 
63
- ### 1. Import the CSS
63
+ TinyBigUI requires **Tailwind CSS v4**. Styles must be loaded through a CSS file processed by Tailwind, not via a direct JS import.
64
64
 
65
- Import the styles in your app's entry point:
65
+ ### 1. Create a CSS entry file
66
+
67
+ ```css
68
+ /* app/globals.css (Next.js) or src/index.css (Vite) */
69
+ @import "tailwindcss";
70
+ @source "../node_modules/@tinybigui/react/dist";
71
+ @import "@tinybigui/react/styles.css";
72
+ ```
73
+
74
+ > `@source` is required so Tailwind scans the library's compiled output and generates all utility classes used by components.
75
+
76
+ ### 2. Import the CSS in your app entry
66
77
 
67
78
  ```tsx
68
- // main.tsx or App.tsx
69
- import "@tinybigui/react/styles.css";
79
+ // app/layout.tsx (Next.js)
80
+ import "./globals.css";
81
+
82
+ // src/main.tsx (Vite)
83
+ import "./index.css";
70
84
  ```
71
85
 
72
- ### 2. Use Components
86
+ ### 3. Use Components
73
87
 
74
88
  ```tsx
75
89
  import { Button, TextField, Checkbox } from "@tinybigui/react";
@@ -87,17 +101,26 @@ function App() {
87
101
  }
88
102
  ```
89
103
 
90
- ### 3. Customize Theme (Optional)
104
+ ### 4. Customize Theme (Optional)
91
105
 
92
- Override CSS variables to customize the theme:
106
+ Override palette variables after the library import to apply your brand colors:
93
107
 
94
108
  ```css
109
+ /* app/globals.css */
110
+ @import "tailwindcss";
111
+ @source "../node_modules/@tinybigui/react/dist";
112
+ @import "@tinybigui/react/styles.css";
113
+
95
114
  :root {
96
- --md-sys-color-primary: #your-color;
97
- --md-sys-color-on-primary: #your-text-color;
115
+ /* Override the primary palette — all components update automatically */
116
+ --md-ref-palette-primary40: #006a6a;
117
+ --md-ref-palette-primary80: #4ddada;
118
+ --md-ref-palette-primary90: #b2fefe;
98
119
  }
99
120
  ```
100
121
 
122
+ See [THEMING.md](./THEMING.md) for the full customization guide.
123
+
101
124
  ---
102
125
 
103
126
  ## 📚 Components
@@ -206,13 +229,15 @@ Dark mode is enabled automatically based on system preferences:
206
229
 
207
230
  ```tsx
208
231
  // Force dark mode
209
- document.documentElement.setAttribute("data-theme", "dark");
232
+ document.documentElement.classList.add("dark");
233
+ document.documentElement.classList.remove("light");
210
234
 
211
235
  // Force light mode
212
- document.documentElement.setAttribute("data-theme", "light");
236
+ document.documentElement.classList.add("light");
237
+ document.documentElement.classList.remove("dark");
213
238
 
214
- // Use system preference
215
- document.documentElement.removeAttribute("data-theme");
239
+ // Revert to OS preference
240
+ document.documentElement.classList.remove("dark", "light");
216
241
  ```
217
242
 
218
243
  ---
@@ -254,11 +279,20 @@ import { Button } from "@tinybigui/react";
254
279
 
255
280
  ## 🔗 Using with Frameworks
256
281
 
282
+ All frameworks require a CSS entry file that includes `@import "tailwindcss"` and `@source` before the library import.
283
+
257
284
  ### Next.js
258
285
 
286
+ ```css
287
+ /* app/globals.css */
288
+ @import "tailwindcss";
289
+ @source "../node_modules/@tinybigui/react/dist";
290
+ @import "@tinybigui/react/styles.css";
291
+ ```
292
+
259
293
  ```tsx
260
294
  // app/layout.tsx
261
- import "@tinybigui/react/styles.css";
295
+ import "./globals.css";
262
296
 
263
297
  export default function RootLayout({ children }) {
264
298
  return (
@@ -271,9 +305,16 @@ export default function RootLayout({ children }) {
271
305
 
272
306
  ### Vite
273
307
 
308
+ ```css
309
+ /* src/index.css */
310
+ @import "tailwindcss";
311
+ @source "./node_modules/@tinybigui/react/dist";
312
+ @import "@tinybigui/react/styles.css";
313
+ ```
314
+
274
315
  ```tsx
275
- // main.tsx
276
- import "@tinybigui/react/styles.css";
316
+ // src/main.tsx
317
+ import "./index.css";
277
318
  import { createRoot } from "react-dom/client";
278
319
  import App from "./App";
279
320
 
@@ -282,9 +323,16 @@ createRoot(document.getElementById("root")!).render(<App />);
282
323
 
283
324
  ### Remix
284
325
 
326
+ ```css
327
+ /* app/root.css */
328
+ @import "tailwindcss";
329
+ @source "../node_modules/@tinybigui/react/dist";
330
+ @import "@tinybigui/react/styles.css";
331
+ ```
332
+
285
333
  ```tsx
286
334
  // app/root.tsx
287
- import styles from "@tinybigui/react/styles.css";
335
+ import styles from "@tinybigui/react/styles.css?url";
288
336
 
289
337
  export const links = () => [{ rel: "stylesheet", href: styles }];
290
338
  ```
@@ -293,24 +341,37 @@ export const links = () => [{ rel: "stylesheet", href: styles }];
293
341
 
294
342
  ## 🛠️ Customization
295
343
 
296
- ### CSS Variables
344
+ ### Brand Colors
297
345
 
298
- All components use CSS custom properties for easy theming:
346
+ Override the palette layer to retheme all components at once. All semantic color roles cascade from these raw palette values:
299
347
 
300
348
  ```css
301
349
  :root {
302
- /* Colors */
303
- --md-sys-color-primary: #6750a4;
304
- --md-sys-color-on-primary: #ffffff;
350
+ /* Teal brand — light mode uses the 40-stop, dark mode uses the 80-stop */
351
+ --md-ref-palette-primary40: #006a6a;
352
+ --md-ref-palette-primary80: #4ddada;
353
+ --md-ref-palette-primary90: #b2fefe;
354
+ --md-ref-palette-primary10: #002020;
355
+ }
356
+ ```
357
+
358
+ Use the [Material Theme Builder](https://m3.material.io/theme-builder) to generate a complete tonal palette from a single hex color.
359
+
360
+ ### Typography
305
361
 
306
- /* Typography */
307
- --md-sys-typescale-body-medium-font-size: 14px;
362
+ ```css
363
+ :root {
364
+ --md-sys-typescale-font-family-plain: "Inter", system-ui, sans-serif;
365
+ --md-sys-typescale-font-family-brand: "Playfair Display", serif;
366
+ }
367
+ ```
308
368
 
309
- /* Shape */
310
- --md-sys-shape-corner-medium: 12px;
369
+ ### Shape
311
370
 
312
- /* Elevation */
313
- --md-sys-elevation-2: 0 1px 3px rgba(0, 0, 0, 0.12);
371
+ ```css
372
+ :root {
373
+ --md-sys-shape-corner-medium: 6px; /* sharper cards */
374
+ --md-sys-shape-corner-large: 10px; /* sharper FABs and drawers */
314
375
  }
315
376
  ```
316
377
 
@@ -322,6 +383,8 @@ Components work seamlessly with Tailwind utilities:
322
383
  <Button className="mt-4 w-full">Custom Styles</Button>
323
384
  ```
324
385
 
386
+ See [THEMING.md](./THEMING.md) for the complete theming reference including dark mode overrides, granular imports, and all available CSS variable namespaces.
387
+
325
388
  ---
326
389
 
327
390
  ## 📖 Documentation