baseline-kit 2.0.1 → 3.0.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 +258 -102
- package/dist/README.md +258 -102
- package/dist/baseline-kit.css +151 -0
- package/dist/components/Baseline/Baseline.d.ts +4 -5
- package/dist/components/Box/Box.d.ts +16 -5
- package/dist/components/Config/Config.d.ts +60 -17
- package/dist/components/Config/defaults.d.ts +2 -2
- package/dist/components/Config/index.d.ts +1 -1
- package/dist/components/Guide/Guide.d.ts +21 -12
- package/dist/components/Guide/index.d.ts +0 -6
- package/dist/components/Guide/types.d.ts +1 -1
- package/dist/components/Layout/Layout.d.ts +10 -6
- package/dist/components/Padder/Padder.d.ts +13 -7
- package/dist/components/Spacer/Spacer.d.ts +40 -11
- package/dist/components/Stack/Stack.d.ts +15 -8
- package/dist/components/index.d.ts +4 -3
- package/dist/components/styles/index.d.ts +11 -0
- package/dist/components/types.d.ts +3 -3
- package/dist/hooks/useBaseline.d.ts +13 -18
- package/dist/hooks/useConfig.d.ts +3 -8
- package/dist/hooks/useDebug.d.ts +1 -6
- package/dist/hooks/useGuide.d.ts +2 -7
- package/dist/hooks/useIsClient.d.ts +6 -0
- package/dist/hooks/useVirtual.d.ts +0 -5
- package/dist/index.cjs +1 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.mjs +1557 -1542
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.ts +6 -0
- package/dist/theme/dark.css +67 -0
- package/dist/theme/default.css +82 -0
- package/dist/theme/tokens.css +82 -0
- package/dist/theme.css +142 -0
- package/dist/theme.d.ts +6 -0
- package/dist/utils/convert.d.ts +0 -22
- package/dist/utils/grid.d.ts +22 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/math.d.ts +20 -36
- package/dist/utils/merge.d.ts +54 -5
- package/dist/utils/normalize.d.ts +0 -35
- package/dist/utils/parse.d.ts +0 -34
- package/dist/utils/snapping.d.ts +0 -5
- package/dist/utils/ssr.d.ts +26 -0
- package/dist/utils/timing.d.ts +0 -5
- package/package.json +81 -39
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Baseline Kit
|
|
2
2
|
|
|
3
|
-
Baseline Kit is a lightweight development tool for visualizing and debugging grid systems and spacing in React
|
|
3
|
+
Baseline Kit is a lightweight development tool for visualizing and debugging grid systems and spacing in React 19
|
|
4
4
|
applications. It provides configurable overlays for both column-based and baseline grids, flexible layout components,
|
|
5
5
|
and theme-aware configuration—all optimized for performance and built with TypeScript.
|
|
6
6
|
|
|
7
|
-

|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -15,6 +15,11 @@ and theme-aware configuration—all optimized for performance and built with Typ
|
|
|
15
15
|
- 📐 **Stack Component:** Flex-based container that maintains consistent spacing and baseline alignment
|
|
16
16
|
- 🎨 **Theme System:** Customizable colors and debug visuals through a centralized configuration
|
|
17
17
|
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- **React 19**: Baseline Kit is built for React 19 and uses the latest React features like the `use` hook
|
|
21
|
+
- **Modern Browsers**: Supporting the latest CSS features
|
|
22
|
+
|
|
18
23
|
## Installation
|
|
19
24
|
|
|
20
25
|
```shell
|
|
@@ -28,18 +33,42 @@ yarn add baseline-kit
|
|
|
28
33
|
pnpm add baseline-kit
|
|
29
34
|
```
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
After installation, import both the styles and theme in your application:
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
```tsx
|
|
39
|
+
// Import in your main entry file (e.g., index.js, App.js)
|
|
40
|
+
import 'baseline-kit/styles'; // Required core styles
|
|
41
|
+
import 'baseline-kit/theme'; // Recommended theme (or use your own)
|
|
42
|
+
```
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
For frameworks like Remix that use URL imports in a links function:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
export const links = () => [
|
|
48
|
+
{ rel: "stylesheet", href: "baseline-kit/styles" },
|
|
49
|
+
{ rel: "stylesheet", href: "baseline-kit/theme" }
|
|
50
|
+
];
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If you prefer a single CSS file that includes everything:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// Alternative: Import everything in one file
|
|
57
|
+
import 'baseline-kit/full';
|
|
58
|
+
|
|
59
|
+
// For Remix:
|
|
60
|
+
export const links = () => [
|
|
61
|
+
{ rel: "stylesheet", href: "baseline-kit/full" }
|
|
62
|
+
];
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Baseline Kit is written in TypeScript and includes built-in type definitions—no additional packages required.
|
|
36
66
|
|
|
37
|
-
|
|
67
|
+
## Quick Start
|
|
38
68
|
|
|
39
69
|
```tsx
|
|
40
70
|
import React from 'react'
|
|
41
71
|
import { Config, Guide, Baseline, Box } from 'baseline-kit'
|
|
42
|
-
import 'baseline-kit/styles.css'
|
|
43
72
|
|
|
44
73
|
function App() {
|
|
45
74
|
const isDev = process.env.NODE_ENV === 'development'
|
|
@@ -97,13 +126,6 @@ unit:
|
|
|
97
126
|
>
|
|
98
127
|
{/* Content automatically aligned to the 8px grid */}
|
|
99
128
|
</Layout>
|
|
100
|
-
|
|
101
|
-
<Stack
|
|
102
|
-
block={[17, 25]} // Top: 16px, Bottom: 24px
|
|
103
|
-
inline={22} // Left/Right: 24px
|
|
104
|
-
>
|
|
105
|
-
{/* Padding automatically adjusted to base unit multiples */}
|
|
106
|
-
</Stack>
|
|
107
129
|
</Config>
|
|
108
130
|
```
|
|
109
131
|
|
|
@@ -113,7 +135,7 @@ Spacing props (`block`, `inline`, `gap`) accept values in three formats:
|
|
|
113
135
|
|
|
114
136
|
```
|
|
115
137
|
// Single number (applies to both sides)
|
|
116
|
-
block={
|
|
138
|
+
block={16} // 16px top and bottom
|
|
117
139
|
|
|
118
140
|
// Array [start, end]
|
|
119
141
|
block={[2, 3]} // 2px top, 3px bottom
|
|
@@ -159,128 +181,207 @@ debugging = "none" // Removes debug elements entirely
|
|
|
159
181
|
#### 3. Configuration
|
|
160
182
|
|
|
161
183
|
- **`Config`** Theme and settings provider
|
|
162
|
-
- **`Padder`** Internal spacing utility
|
|
163
184
|
|
|
164
|
-
###
|
|
185
|
+
### Key Components
|
|
165
186
|
|
|
166
|
-
|
|
187
|
+
#### Config
|
|
167
188
|
|
|
168
189
|
```tsx
|
|
169
190
|
<Config
|
|
170
191
|
base={8} // Base unit for calculations
|
|
171
192
|
baseline={{ debugging }} // Baseline grid visibility
|
|
172
|
-
guide={{
|
|
173
|
-
debugging,
|
|
174
|
-
colors: {
|
|
175
|
-
line: 'rgba(0,0,255,0.1)'
|
|
176
|
-
}
|
|
177
|
-
}}
|
|
193
|
+
guide={{ debugging }} // Guide customization
|
|
178
194
|
>
|
|
179
195
|
{children}
|
|
180
196
|
</Config>
|
|
181
197
|
```
|
|
182
198
|
|
|
183
|
-
|
|
199
|
+
#### Baseline
|
|
184
200
|
|
|
185
201
|
```tsx
|
|
186
202
|
<Baseline
|
|
187
|
-
base={8} // Base unit (defaults to Config value)
|
|
188
203
|
height="100vh" // Overlay height
|
|
189
204
|
variant="line" // "line" or "flat"
|
|
190
205
|
debugging="visible" // Show the grid overlay
|
|
191
206
|
/>
|
|
192
207
|
```
|
|
193
208
|
|
|
194
|
-
|
|
209
|
+
#### Guide
|
|
195
210
|
|
|
196
211
|
```tsx
|
|
197
212
|
<Guide
|
|
198
|
-
variant="pattern"
|
|
199
|
-
columns={['100px', '1fr', '100px']}
|
|
200
|
-
gap={8}
|
|
201
|
-
|
|
202
|
-
width="1200px" // Container width
|
|
203
|
-
debugging="visible" // Show grid overlay
|
|
213
|
+
variant="pattern" // "line", "pattern", "fixed", or "auto"
|
|
214
|
+
columns={['100px', '1fr', '100px']} // Column definition
|
|
215
|
+
gap={8} // Gap value
|
|
216
|
+
width="1200px" // Container width
|
|
204
217
|
/>
|
|
205
218
|
```
|
|
206
219
|
|
|
207
|
-
|
|
220
|
+
#### Box
|
|
208
221
|
|
|
209
222
|
```tsx
|
|
210
223
|
<Box
|
|
211
|
-
block={[2, 5]} // Vertical padding in base units
|
|
224
|
+
block={[2, 5]} // Vertical padding in base units
|
|
212
225
|
span={2} // Grid column span when used in Layout
|
|
213
226
|
snapping="height" // "none", "height", or "clamp"
|
|
214
|
-
debugging="visible" // Show alignment guides
|
|
215
227
|
>
|
|
216
228
|
<p>Content aligned to baseline grid</p>
|
|
217
229
|
</Box>
|
|
218
230
|
```
|
|
219
231
|
|
|
220
|
-
|
|
232
|
+
## Theme System
|
|
233
|
+
|
|
234
|
+
Baseline Kit comes with a flexible CSS structure and theming system:
|
|
235
|
+
|
|
236
|
+
1. `core.css` - Contains the core component styles required for functionality (imported via `baseline-kit/styles`)
|
|
237
|
+
2. `theme.css` - Contains color variables and theming with automatic dark mode support (imported via `baseline-kit/theme`)
|
|
238
|
+
3. `baseline-kit.css` - Combined file with both core and theme styles (imported via `baseline-kit/full`)
|
|
239
|
+
|
|
240
|
+
### CSS Import Options
|
|
241
|
+
|
|
242
|
+
Baseline Kit gives you flexibility in how you include the styles:
|
|
221
243
|
|
|
222
244
|
```tsx
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
align="center" // Flex align-items
|
|
230
|
-
debugging="visible" // Show alignment guides
|
|
231
|
-
>
|
|
232
|
-
<Box>Item 1</Box>
|
|
233
|
-
<Box>Item 2</Box>
|
|
234
|
-
</Stack>
|
|
245
|
+
// Option 1: Import core styles and theme separately (recommended)
|
|
246
|
+
import 'baseline-kit/styles';
|
|
247
|
+
import 'baseline-kit/theme';
|
|
248
|
+
|
|
249
|
+
// Option 2: Import everything in one file
|
|
250
|
+
import 'baseline-kit/full';
|
|
235
251
|
```
|
|
236
252
|
|
|
237
|
-
###
|
|
253
|
+
### Theme Options
|
|
254
|
+
|
|
255
|
+
You now have four options for using the theme system:
|
|
256
|
+
|
|
257
|
+
#### 1. Use the Built-in Theme (with automatic dark mode)
|
|
238
258
|
|
|
239
259
|
```tsx
|
|
240
|
-
|
|
241
|
-
columns={3} // Number of columns or pattern array
|
|
242
|
-
gap={16} // Gap value
|
|
243
|
-
block={16} // Vertical padding (auto-snapping)
|
|
244
|
-
inline={8} // Horizontal padding (auto-snapping)
|
|
245
|
-
debugging="visible" // Show grid guides
|
|
246
|
-
>
|
|
247
|
-
<Box span={2}>Wide content</Box>
|
|
248
|
-
<Box>Regular content</Box>
|
|
249
|
-
</Layout>
|
|
260
|
+
import 'baseline-kit/theme'; // Default theme with light/dark mode support
|
|
250
261
|
```
|
|
251
262
|
|
|
252
|
-
|
|
263
|
+
#### 2. Use Specific Theme Variants
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
// Use only the light theme (no dark mode)
|
|
267
|
+
import 'baseline-kit/theme/default';
|
|
268
|
+
|
|
269
|
+
// Use only the dark theme
|
|
270
|
+
import 'baseline-kit/theme/dark';
|
|
271
|
+
|
|
272
|
+
// Example: Apply dark theme regardless of system preference
|
|
273
|
+
import 'baseline-kit/styles';
|
|
274
|
+
import 'baseline-kit/theme/dark';
|
|
275
|
+
```
|
|
253
276
|
|
|
254
|
-
|
|
277
|
+
#### 3. Create a Custom Theme
|
|
255
278
|
|
|
256
|
-
|
|
279
|
+
You can use the tokens template as a starting point:
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
// First check the token template to see available variables
|
|
283
|
+
import 'baseline-kit/theme/tokens'; // Just for reference (contains no values)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Then create your own custom theme file:
|
|
287
|
+
|
|
288
|
+
```css
|
|
289
|
+
/* yourCustomTheme.css */
|
|
290
|
+
:root {
|
|
291
|
+
/* Component-specific colors */
|
|
292
|
+
--bk-baseline-color-line-theme: hsla(210, 100%, 50%, 0.15);
|
|
293
|
+
--bk-baseline-color-flat-theme: hsla(270, 100%, 60%, 0.2);
|
|
294
|
+
/* Add other component colors as needed */
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Optional dark mode support */
|
|
298
|
+
@media (prefers-color-scheme: dark) {
|
|
299
|
+
:root {
|
|
300
|
+
--bk-baseline-color-line-theme: hsla(210, 100%, 50%, 0.2);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Then import your custom theme:
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
import 'baseline-kit/styles'; // Required core styles
|
|
309
|
+
import './path/to/yourCustomTheme.css'; // Your custom theme
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### 4. Override via Config
|
|
313
|
+
|
|
314
|
+
For minor adjustments, use the Config component:
|
|
257
315
|
|
|
258
316
|
```tsx
|
|
259
317
|
<Config
|
|
260
|
-
base={8}
|
|
261
|
-
guide={{
|
|
262
|
-
colors: {
|
|
263
|
-
line: 'rgba(0,0,255,0.1)',
|
|
264
|
-
pattern: 'rgba(0,0,255,0.05)',
|
|
265
|
-
auto: 'rgba(0,0,255,0.05)',
|
|
266
|
-
fixed: 'rgba(0,0,255,0.05)'
|
|
267
|
-
}
|
|
268
|
-
}}
|
|
269
318
|
baseline={{
|
|
270
319
|
colors: {
|
|
271
|
-
line: 'rgba(255,0,0,0.1)',
|
|
272
|
-
flat: 'rgba(255,0,0,0.05)'
|
|
320
|
+
line: 'rgba(255,0,0,0.1)', // Custom red baseline lines
|
|
321
|
+
flat: 'rgba(255,0,0,0.05)', // Custom red baseline backgrounds
|
|
273
322
|
}
|
|
274
323
|
}}
|
|
275
324
|
>
|
|
276
|
-
{
|
|
325
|
+
{/* Your components here */}
|
|
277
326
|
</Config>
|
|
278
327
|
```
|
|
279
328
|
|
|
280
|
-
|
|
281
|
-
through CSS media queries. No additional configuration is required.
|
|
329
|
+
### Theme Variables Reference
|
|
282
330
|
|
|
283
|
-
|
|
331
|
+
| Component | Variable Pattern | Purpose |
|
|
332
|
+
|-----------|-----------------|---------|
|
|
333
|
+
| Baseline | `--bk-baseline-color-[line/flat]-theme` | Colors for lines and backgrounds |
|
|
334
|
+
| Guide | `--bk-guide-color-[line/pattern/auto/fixed]-theme` | Colors for different guide variants |
|
|
335
|
+
| Box | `--bk-box-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
|
|
336
|
+
| Stack | `--bk-stack-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
|
|
337
|
+
| Layout | `--bk-layout-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
|
|
338
|
+
| Spacer | `--bk-spacer-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
|
|
339
|
+
|
|
340
|
+
See the [default theme file](https://github.com/dnvt/baseline-kit/blob/main/dist/theme.css) for a complete example.
|
|
341
|
+
|
|
342
|
+
## Browser Support
|
|
343
|
+
|
|
344
|
+
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
345
|
+
- Requires CSS Grid Layout support and CSS Custom Properties
|
|
346
|
+
- Falls back gracefully in unsupported browsers
|
|
347
|
+
|
|
348
|
+
## React 19 Features
|
|
349
|
+
|
|
350
|
+
Baseline Kit leverages React 19's latest features:
|
|
351
|
+
|
|
352
|
+
- **`use` Hook**: Replaces `useContext` for better performance and cleaner code
|
|
353
|
+
- **Streamlined Context API**: Uses the simplified Context Provider syntax
|
|
354
|
+
- **JSX Transform**: Takes advantage of the mandatory JSX transform in React 19
|
|
355
|
+
|
|
356
|
+
These modern features allow for cleaner code and better performance, but require React 19.
|
|
357
|
+
|
|
358
|
+
## Server-Side Rendering (SSR)
|
|
359
|
+
|
|
360
|
+
Baseline Kit is fully compatible with React's Server-Side Rendering in frameworks like Next.js, Remix, and other React Router-based applications.
|
|
361
|
+
|
|
362
|
+
### SSR-Friendly Design
|
|
363
|
+
|
|
364
|
+
Components are designed to:
|
|
365
|
+
- Provide consistent rendering between server and client
|
|
366
|
+
- Avoid hydration mismatches by using deterministic initial values
|
|
367
|
+
- Progressively enhance with client-side measurements after hydration
|
|
368
|
+
- Work with frameworks that use streaming SSR
|
|
369
|
+
|
|
370
|
+
### SSR Mode Prop
|
|
371
|
+
|
|
372
|
+
Components accept an `ssrMode` prop to explicitly optimize for server rendering:
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
<Baseline
|
|
376
|
+
height="100vh"
|
|
377
|
+
ssrMode={true}
|
|
378
|
+
debugging="visible"
|
|
379
|
+
/>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
With `ssrMode` enabled, components use simplified rendering during SSR and initial hydration, then enhance with full features after client-side hydration completes.
|
|
383
|
+
|
|
384
|
+
## Development
|
|
284
385
|
|
|
285
386
|
```shell
|
|
286
387
|
# Clone the repository
|
|
@@ -294,39 +395,94 @@ bun run dev
|
|
|
294
395
|
|
|
295
396
|
# Run tests
|
|
296
397
|
bun run test
|
|
297
|
-
|
|
298
|
-
# Build package
|
|
299
|
-
bun run build
|
|
300
398
|
```
|
|
301
399
|
|
|
302
|
-
##
|
|
303
|
-
|
|
304
|
-
Baseline Kit is compatible with SSR frameworks like Next.js and Gatsby. The overlay components automatically handle
|
|
305
|
-
hydration mismatches.
|
|
306
|
-
|
|
307
|
-
## Browser Support
|
|
308
|
-
|
|
309
|
-
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
310
|
-
- Requires CSS Grid Layout support
|
|
311
|
-
- Requires CSS Custom Properties (CSS Variables)
|
|
312
|
-
- Falls back gracefully in unsupported browsers
|
|
313
|
-
|
|
314
|
-
## Performance Considerations
|
|
400
|
+
## Performance Features
|
|
315
401
|
|
|
316
|
-
- Uses requestAnimationFrame for smooth animations
|
|
317
402
|
- Virtualizes large grid overlays
|
|
318
403
|
- Optimizes re-renders using React.memo
|
|
319
404
|
- Supports tree-shaking for minimal bundle size
|
|
320
405
|
|
|
321
406
|
## Contributing
|
|
322
407
|
|
|
323
|
-
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines
|
|
324
|
-
|
|
325
|
-
- Development setup
|
|
326
|
-
- Code style
|
|
327
|
-
- Testing requirements
|
|
328
|
-
- Pull request process
|
|
408
|
+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
329
409
|
|
|
330
410
|
## License
|
|
331
411
|
|
|
332
|
-
MIT © [François Denavaut](https://github.com/dnvt)
|
|
412
|
+
MIT © [François Denavaut](https://github.com/dnvt)
|
|
413
|
+
|
|
414
|
+
## Integration with Remix
|
|
415
|
+
|
|
416
|
+
Baseline Kit is fully compatible with Remix. Follow these steps to integrate it into your Remix application:
|
|
417
|
+
|
|
418
|
+
### Standard Integration
|
|
419
|
+
|
|
420
|
+
In your Remix application, create a `root.tsx` file with proper links to the CSS:
|
|
421
|
+
|
|
422
|
+
```tsx
|
|
423
|
+
// app/root.tsx
|
|
424
|
+
import type { LinksFunction } from '@remix-run/node';
|
|
425
|
+
|
|
426
|
+
export const links: LinksFunction = () => [
|
|
427
|
+
// Option 1: Use the combined CSS file (simplest approach)
|
|
428
|
+
{ rel: 'stylesheet', href: 'npm:baseline-kit/dist/baseline-kit.css' },
|
|
429
|
+
|
|
430
|
+
// Option 2: Or use core styles and theme separately
|
|
431
|
+
// { rel: 'stylesheet', href: 'npm:baseline-kit/dist/styles.css' },
|
|
432
|
+
// { rel: 'stylesheet', href: 'npm:baseline-kit/dist/theme.css' },
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
export default function App() {
|
|
436
|
+
return (
|
|
437
|
+
<html lang="en">
|
|
438
|
+
<head>
|
|
439
|
+
<meta charSet="utf-8" />
|
|
440
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
441
|
+
<Links />
|
|
442
|
+
</head>
|
|
443
|
+
<body>
|
|
444
|
+
<Outlet />
|
|
445
|
+
<ScrollRestoration />
|
|
446
|
+
<Scripts />
|
|
447
|
+
<LiveReload />
|
|
448
|
+
</body>
|
|
449
|
+
</html>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Note the use of `npm:` prefix which is the recommended way to reference CSS from node_modules in Remix.
|
|
455
|
+
|
|
456
|
+
### Troubleshooting CSS in Remix
|
|
457
|
+
|
|
458
|
+
If you're experiencing styling issues with components not showing properly:
|
|
459
|
+
|
|
460
|
+
1. **Copy to public directory**: For a completely reliable solution, copy the CSS files to your public directory:
|
|
461
|
+
```shell
|
|
462
|
+
mkdir -p public/css
|
|
463
|
+
cp node_modules/baseline-kit/dist/*.css public/css/
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Then reference these local files:
|
|
467
|
+
```tsx
|
|
468
|
+
export const links: LinksFunction = () => [
|
|
469
|
+
{ rel: 'stylesheet', href: '/css/baseline-kit.css' }
|
|
470
|
+
];
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
2. **Check CSS specificity**: Make sure your application's CSS isn't overriding Baseline Kit styles. You may need to adjust specificity or load order of your stylesheets.
|
|
474
|
+
|
|
475
|
+
### Custom Theme Integration
|
|
476
|
+
|
|
477
|
+
For custom theming:
|
|
478
|
+
|
|
479
|
+
```tsx
|
|
480
|
+
export const links: LinksFunction = () => [
|
|
481
|
+
// Core styles (required)
|
|
482
|
+
{ rel: 'stylesheet', href: 'npm:baseline-kit/dist/styles.css' },
|
|
483
|
+
// Choose one of these theme options:
|
|
484
|
+
{ rel: 'stylesheet', href: 'npm:baseline-kit/dist/theme/default.css' }, // Light theme only
|
|
485
|
+
{ rel: 'stylesheet', href: 'npm:baseline-kit/dist/theme/dark.css' }, // Dark theme only
|
|
486
|
+
{ rel: 'stylesheet', href: '/css/custom-theme.css' }, // Your custom theme
|
|
487
|
+
];
|
|
488
|
+
```
|