mindmapcn-solid
v0.0.1
Published
Beautiful shadcn-styled mind map component for Solid, powered by Mind Elixir
Maintainers
Readme
mindmapcn-solid
Beautiful shadcn-styled mind map component for Solid, powered by Mind Elixir. The Solid port of mindmapcn, packaged as a regular library — no Tailwind or shadcn setup required.
[!NOTE] Not published yet.
mindmapcn-solidis not on npm and the docs site is not live, so the install command below will not work until the first release. To try it locally, runpnpm install && pnpm build, thennpm packand install the generated tarball in your app. Remove this note after publishing.
Quick start
Install it:
npm i mindmapcn-solid
# or
yarn add mindmapcn-solid
# or
pnpm add mindmapcn-solidUse it:
import { MindMap, MindMapControls } from 'mindmapcn-solid'
const data = `My Mind Map
Topic A
Subtopic 1
Subtopic 2
Topic B`
function App() {
return (
<div style={{ height: '480px' }}>
<MindMap data={data}>
<MindMapControls />
</MindMap>
</div>
)
}data accepts either a MindElixirData object or a Mind Elixir plaintext string (indentation-based outline).
Components
<MindMap />
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| data | MindElixirData \| string | — | Map data (object or plaintext outline) |
| class | string | — | Extra class on the wrapper element |
| direction | 0 \| 1 \| 2 | 2 | Layout direction (left / right / both sides) |
| contextMenu | boolean | true | Enable right-click context menu |
| keypress | boolean | true | Enable keyboard shortcuts |
| locale | 'en' \| 'zh_CN' \| 'zh_TW' \| 'ja' \| 'pt' | 'en' | UI language |
| overflowHidden | boolean | false | Disable map panning overflow |
| theme | 'light' \| 'dark' | auto | Force a theme; otherwise detected from the dark/light class on <html> or system preference |
| monochrome | boolean | false | Single-color branch palette |
| fit | boolean | true | Auto scale-to-fit after init |
| readonly | boolean | false | Disable editing |
| compact | boolean | false | Compact layout with tighter node spacing |
| markdown | (text, obj) => string | — | Custom markdown parser for node topics |
| imageProxy | (url) => string | — | Rewrite remote image URLs for export |
| onChange | (data, operation) => void | — | Fired after each edit with the updated data |
| onOperation | (operation) => void | — | Fired for every operation |
| onSelectNodes | (nodes) => void | — | Fired when nodes are selected |
| loader | JSX.Element | spinner | Custom loading placeholder |
| ref | (ref: MindMapRef) => void | — | Receives { instance } exposing the MindElixirInstance |
<MindMapControls />
Must be placed inside <MindMap>. Renders zoom, fit, fullscreen and export-as-image buttons.
| Prop | Type | Default |
| --- | --- | --- |
| position | 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' | 'top-right' |
| showZoom | boolean | true |
| showFit | boolean | true |
| showExport | boolean | true |
| onExport | (file: Blob, filename: string) => void | — |
useMindMap()
Access the mind map from any child of <MindMap>:
const { mind, isLoaded } = useMindMap()
// mind() → MindElixirInstance | null
// isLoaded() → booleanDevelopment
pnpm install
pnpm dev # start the playground at http://localhost:3000
pnpm build # build the library with tsup
pnpm test # run client + SSR tests