This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
@gfazioli/mantine-split-pane — A Mantine-based React component library providing resizable split pane layouts. Current version in package/package.json.
yarn dev # Docs dev server on port 9281
yarn storybook # Storybook on port 8271
yarn build # Rollup → ESM + CJS + types + CSS (output: package/dist/)
yarn clean # Remove package/dist
yarn test # Full suite: syncpack → prettier → typecheck → lint → jest
yarn jest # Unit tests only (jest)
yarn jest --testPathPattern=Split.test # Run a single test file
yarn docgen # Generate docs/docgen.json from TypeScript types
yarn lint # ESLint + StyleLint
yarn prettier:write # Auto-fix formatting
yarn docs:deploy # Build and deploy docs to GitHub Pages
yarn release:patch # Bump version, publish to npm, deploy docsSplit (container) → Split.Pane (content) + Split.Resizer (drag handle between panes)
- Split (
package/src/Split.tsx) — Factory component that manages orientation (vertical/horizontal, supports responsive breakpoints). ProvidesSplitContextProviderto cascade resizer props to all child resizers. - Split.Pane (
package/src/Pane/SplitPane.tsx) — Pane with sizing constraints (initialWidth/Height,min/max,grow). Exposes imperative handlers via ref (resetInitialSize,getMinWidth, etc.). - Split.Resizer (
package/src/Resizer/SplitResizer.tsx) — Draggable/keyboard-navigable divider with variants (default,filled,outline,transparent,gradient,dotted,dashed). Inherits props from parent Split context but can override per-instance. - Split.Dynamic (
package/src/Dynamic/) — Helper function (not a component) that generates Pane+Resizer arrays from aPaneConfig[]array.
- Mantine Factory Pattern — All components use
factory<T>()withXFactorytypes definingprops,ref,stylesNames,vars. CSS variables usevarsResolver. - Context-based Prop Inheritance (
package/src/Split.context.ts) — Resizer props set on<Split>cascade to all<Split.Resizer>children; individual resizers can override. - Responsive Orientation (
package/src/hooks/use-split-resizer-orientation.ts) —orientationaccepts a string or Mantine breakpoint object:{ base: 'horizontal', sm: 'vertical' }. - Dynamic Panes — When conditionally rendering panes, always use unique
keyprops on both Pane and Resizer elements.
- Rollup (
rollup.config.mjs) → ESM (.mjs) + CJS (.cjs) with source maps scripts/generate-dts.ts→ TypeScript declarationsscripts/prepare-css.ts→styles.css+styles.layer.css- CSS Modules scoped with
hash-css-selector(prefixme)
package/— npm package source and build outputdocs/— Next.js 15 documentation site with interactive demos (docs/demos/)scripts/— Release, docgen, and build automation
- English only for all code, comments, commit messages, and docs
- Components:
PascalCase.tsx, Styles:ComponentName.module.css, Hooks:use-kebab-case.ts - CSS variables:
--split-{component}-{property}(e.g.,--split-resizer-size) - Props extend
BoxProps+StylesApiProps<TFactory>from Mantine - Tests use
@mantine-tests/corefor rendering, live alongside components inpackage/src/ - JSDoc on all public interfaces, exported types, and non-trivial internal functions — always in English
Each demo in docs/demos/ exports a MantineDemo object consumed by docs/docs.mdx. Key points:
- Configurator demos have a
controlsarray withinitialValue/libraryValue— these must match the actual component defaults inSplitResizer.tsx:defaultProps - Code strings (the
const codetemplate literals) are displayed to users as copyable examples — they must stay in sync with the actual component code above them - All 7 resizer variants must be listed wherever variant options appear:
default,filled,outline,transparent,gradient,dotted,dashed
- Add to
SplitResizerContextPropsinpackage/src/Resizer/SplitResizer.tsx - Update
defaultPropsin the same file - Add CSS variable to
varsResolverif styling-related - Update context in
package/src/Split.context.tsonly if the prop is NOT already inSplitResizerContextProps(e.g.,variantis added separately because it flows through the factory system) - Destructure and pass through in
Split.tsx(props + context provider value) - Run
yarn docgento regenerate API docs