react-split-pane 3.0.0 → 3.0.2

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.
Files changed (2) hide show
  1. package/README.md +110 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,7 @@ Modern, accessible, TypeScript-first split pane component for React.
4
4
 
5
5
  [![NPM version](https://img.shields.io/npm/v/react-split-pane.svg?style=flat)](https://www.npmjs.com/package/react-split-pane)
6
6
  ![NPM license](https://img.shields.io/npm/l/react-split-pane.svg?style=flat)
7
+ [![NPM downloads](https://img.shields.io/npm/dm/react-split-pane.svg?style=flat)](https://www.npmjs.com/package/react-split-pane)
7
8
  [![Bundle size](https://img.shields.io/bundlephobia/minzip/react-split-pane)](https://bundlephobia.com/package/react-split-pane)
8
9
 
9
10
  **[Live Examples](https://tomkp.github.io/react-split-pane)**
@@ -339,6 +340,115 @@ A subtle single-pixel divider:
339
340
  }
340
341
  ```
341
342
 
343
+ ## Tailwind CSS & shadcn/ui
344
+
345
+ React Split Pane works seamlessly with Tailwind CSS and shadcn/ui. The component uses plain CSS and inline styles (no CSS-in-JS), so there are no conflicts with utility-first frameworks.
346
+
347
+ ### Using Tailwind Classes
348
+
349
+ Apply Tailwind classes directly via `className` props. Skip importing the default stylesheet for full Tailwind control:
350
+
351
+ ```tsx
352
+ import { SplitPane, Pane } from 'react-split-pane';
353
+ // Don't import 'react-split-pane/styles.css' if using Tailwind
354
+
355
+ <SplitPane
356
+ className="h-screen w-full"
357
+ dividerClassName="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 transition-colors"
358
+ >
359
+ <Pane defaultSize="300px" className="bg-white dark:bg-gray-900 p-4">
360
+ <Sidebar />
361
+ </Pane>
362
+ <Pane className="bg-gray-50 dark:bg-gray-800 p-4">
363
+ <MainContent />
364
+ </Pane>
365
+ </SplitPane>
366
+ ```
367
+
368
+ ### shadcn/ui Integration
369
+
370
+ Use shadcn's CSS variables and utilities for consistent theming:
371
+
372
+ ```tsx
373
+ import { SplitPane, Pane } from 'react-split-pane';
374
+
375
+ <SplitPane
376
+ className="h-full w-full"
377
+ dividerClassName="bg-border hover:bg-accent transition-colors"
378
+ >
379
+ <Pane defaultSize="280px" className="bg-background border-r">
380
+ <Sidebar />
381
+ </Pane>
382
+ <Pane className="bg-muted/50">
383
+ <MainContent />
384
+ </Pane>
385
+ </SplitPane>
386
+ ```
387
+
388
+ ### Custom Divider with shadcn
389
+
390
+ Create a themed divider component using shadcn's `cn` utility:
391
+
392
+ ```tsx
393
+ import { cn } from '@/lib/utils';
394
+ import type { DividerProps } from 'react-split-pane';
395
+
396
+ function ThemedDivider({ direction, isDragging, disabled, ...props }: DividerProps) {
397
+ return (
398
+ <div
399
+ className={cn(
400
+ 'flex items-center justify-center transition-colors',
401
+ 'bg-border hover:bg-accent focus:outline-none focus:ring-2 focus:ring-ring',
402
+ direction === 'horizontal'
403
+ ? 'w-1 cursor-col-resize'
404
+ : 'h-1 cursor-row-resize',
405
+ isDragging && 'bg-primary',
406
+ disabled && 'cursor-not-allowed opacity-50'
407
+ )}
408
+ {...props}
409
+ />
410
+ );
411
+ }
412
+
413
+ <SplitPane divider={ThemedDivider}>
414
+ <Pane>Left</Pane>
415
+ <Pane>Right</Pane>
416
+ </SplitPane>
417
+ ```
418
+
419
+ ### CSS Variables with Tailwind
420
+
421
+ Override the default CSS variables in your `globals.css` to match your Tailwind theme:
422
+
423
+ ```css
424
+ /* globals.css */
425
+ @layer base {
426
+ :root {
427
+ --split-pane-divider-size: 4px;
428
+ --split-pane-divider-color: theme('colors.gray.200');
429
+ --split-pane-divider-color-hover: theme('colors.gray.300');
430
+ --split-pane-focus-color: theme('colors.blue.500');
431
+ }
432
+
433
+ .dark {
434
+ --split-pane-divider-color: theme('colors.gray.700');
435
+ --split-pane-divider-color-hover: theme('colors.gray.600');
436
+ }
437
+ }
438
+ ```
439
+
440
+ Or with shadcn/ui CSS variables:
441
+
442
+ ```css
443
+ @layer base {
444
+ :root {
445
+ --split-pane-divider-color: hsl(var(--border));
446
+ --split-pane-divider-color-hover: hsl(var(--accent));
447
+ --split-pane-focus-color: hsl(var(--ring));
448
+ }
449
+ }
450
+ ```
451
+
342
452
  ## Migration from v0.1.x
343
453
 
344
454
  See [MIGRATION.md](./MIGRATION.md) for detailed migration guide.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-split-pane",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "React split-pane component with hooks and TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",