Logo von React Mosaic

React Mosaic

CommunityBeliebt
nomcopter
react-mosaic

Build tiling window manager layouts in React with react-mosaic-component (v7) - resizable, drag-and-drop rearrangeable panels, splits and tab groups. Use when writing or changing code that imports react-mosaic-component, uses Mosaic / MosaicWindow / MosaicNode, or when asked for an IDE-like, dockable, resizable or tiled panel layout in React.

Übersicht

Herausgebernomcopter
Repositoryreact-mosaic
Skill-Namereact-mosaic
Sterne
4.8K
Forks
242
Mitgelieferte Dateien
Nur Anweisungen
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • In sich abgeschlossen

    Alles, was das Modell braucht, steht in den Anweisungen — keine zusätzlichen Dateien zum Synchronisieren.

  • Open Source

    Von nomcopter auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill React Mosaic in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/nomcopter/react-mosaic/tree/master/skills/react-mosaic
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nomcopter/react-mosaic.git /tmp/react-mosaic
mkdir -p .claude/skills
cp -r /tmp/react-mosaic/skills/react-mosaic .claude/skills/react-mosaic
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie React Mosaic in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt React Mosaic automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist React Mosaic nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

react-mosaic-component (v7)

A React tiling window manager (React 16-19, TypeScript). The layout is an immutable n-ary tree of panels. Full docs: https://nomcopter.github.io/react-mosaic/

v7 is not v6. Most examples online (and in older training data) use the v6 binary tree (first / second, splitPercentage, string paths like ['first']). That shape is legacy. Write v7 code as shown here.

Setup

bash
npm install react-mosaic-component
tsx
import 'react-mosaic-component/react-mosaic-component.css'; // required

<Mosaic> fills its parent, so the parent must have a real height (e.g. height: 100vh), otherwise nothing is visible.

Minimal example

tsx
import { Mosaic, MosaicWindow, type MosaicNode } from 'react-mosaic-component';
import 'react-mosaic-component/react-mosaic-component.css';

const initial: MosaicNode<string> = {
  type: 'split',
  direction: 'row', // 'row' = side by side, 'column' = stacked
  splitPercentages: [30, 70], // optional, sums to 100
  children: [
    'files',
    { type: 'split', direction: 'column', children: ['editor', 'terminal'] },
  ],
};

export function App() {
  return (
    <div style={{ height: '100vh' }}>
      <Mosaic<string>
        initialValue={initial}
        renderTile={(id, path) => (
          <MosaicWindow<string> path={path} title={id}>
            <Panel id={id} />
          </MosaicWindow>
        )}
      />
    </div>
  );
}

renderTile(key, path) is called for every leaf. Pass the path it gives you straight to MosaicWindow; never compute paths yourself.

The tree

ts
type MosaicKey = string | number; // a leaf is just its key
type MosaicNode<T> = MosaicSplitNode<T> | MosaicTabsNode<T> | T;

interface MosaicSplitNode<T> {
  type: 'split';
  direction: 'row' | 'column';
  children: MosaicNode<T>[]; // any number of children
  splitPercentages?: number[]; // one per child, sums to 100; omit for equal sizes
}

interface MosaicTabsNode<T> {
  type: 'tabs';
  tabs: T[]; // leaf keys only, tab groups don't nest
  activeTabIndex: number;
}
  • A bare key ('editor') is a valid whole tree: one full-size window.
  • null is an empty layout; zeroStateView is shown.
  • Keys must be unique in the tree. They are your IDs: map them to content in renderTile, don't put components or objects in the tree. Keep the tree JSON-serialisable so it can be persisted.
  • Paths are numeric index arrays: [] is the root, [1, 0] is the first child of the second child. For a tab group, the active tab's path is the group's path plus the tab index.
  • Narrow with isSplitNode(node) / isTabsNode(node); anything else is a leaf.

Controlled vs uncontrolled

Use either initialValue (Mosaic owns the state) or value + onChange (you own it). Never both. Go controlled whenever you persist the layout or change it from outside.

tsx
const [tree, setTree] = useState<MosaicNode<string> | null>(initial);

<Mosaic<string>
  value={tree}
  onChange={setTree} // every change, including each frame of a resize drag
  onRelease={(next) => save(next)} // once per finished interaction: persist here
  renderTile={renderTile}
/>;

Both callbacks get a second meta argument describing the change, e.g. { type: 'remove', path, node }, { type: 'resize', path, splitPercentages }, { type: 'drop', node, sourcePath, destinationPath, position?, tabIndex?, swap? }, { type: 'tab-add' | 'tab-remove' | 'tab-select', ... }. Paths in meta refer to the tree before the change. See MosaicChangeMeta.

Changing the tree

Never mutate a tree in place; the UI won't update. Two ways to change it:

Inside the mosaic (toolbar buttons, tile content), use the context actions:

tsx
import { useMosaic, useMosaicWindow } from 'react-mosaic-component';

function CloseButton({ path }: { path: MosaicPath }) {
  const { mosaicActions } = useMosaic<string>();
  return <button onClick={() => mosaicActions.remove(path)}>Close</button>;
}
// mosaicActions: remove(path), expand(path, pct?), replaceWith(path, node),
//   updateTree(updates), addTab(path), removeTab(path, index), getRoot()
// useMosaicWindow().mosaicWindowActions: split(), addTab(), replaceWithNew(),
//   getPath(), setAdditionalControlsOpen(open | 'toggle'), connectDragSource(el)

split(), addTab() and replaceWithNew() need the createNode prop (on Mosaic or MosaicWindow), which returns the new node (or a promise of one).

Outside the mosaic (controlled mode), compute a new tree and setTree it:

ts
import {
  updateTree,
  createRemoveUpdate,
  createExpandUpdate,
} from 'react-mosaic-component';

setTree((t) => (t ? updateTree(t, [createRemoveUpdate(t, [1, 0])]) : t));

Helpers (all pure, return new objects):

HelperUse
updateTree(tree, updates)apply MosaicUpdate[] ({ path, spec }, spec is an immutability-helper command)
createRemoveUpdate(tree, path)remove a node, collapsing its parent
createExpandUpdate(path, percentage)grow a node at every level up to the root
createSwapUpdates(tree, pathA, pathB)swap two nodes (returns an array)
createDragToUpdates(tree, source, dest, dropInfo)what a drag does, e.g. { type: 'split', position: 'left' } (returns an array)
getNodeAtPath(tree, path), getParentNode, getParentPathreads
getLeaves(tree)all leaf keys, e.g. to check if a panel is open
createBalancedTreeFromLeaves(keys, 'row')build a layout from a list of keys
convertLegacyToNary(tree)convert a stored v6 tree

To add a panel from outside, the simplest correct approach is to rebuild: createBalancedTreeFromLeaves([...getLeaves(tree), 'new']), or wrap the root: { type: 'split', direction: 'row', children: [tree, 'new'] }.

MosaicWindow

tsx
<MosaicWindow<string>
  path={path} // required, from renderTile
  title="Editor" // required
  toolbarControls={[<SplitButton key="s" />, <RemoveButton key="r" />]} // replaces default buttons
  createNode={() => nextId()}
  draggable // default true; false disables dragging by the title bar
  renderToolbar={(props, draggable) => <MyToolbar />} // optional: replace the whole title bar
>
  ...
</MosaicWindow>

Toolbar building blocks: ExpandButton, SplitButton, ReplaceButton, RemoveButton, Separator, DefaultToolbarButton, DEFAULT_CONTROLS_WITH_CREATION, DEFAULT_CONTROLS_WITHOUT_CREATION. Using MosaicWindow is optional: renderTile can return any element.

Tabs

Put a { type: 'tabs', tabs: ['a', 'b'], activeTabIndex: 0 } node anywhere a leaf can go. renderTile is called only for the active tab. Tab-related Mosaic props: canClose(tabKey, tabs, index, path) returning 'canClose' | 'cannotClose' | 'noClose', renderTabTitle, renderTabButton, renderTabToolbarControls (compose DefaultAddTabButton, TabSplitButton, TabRemoveButton), and renderTabToolbar for a fully custom tab bar.

Other Mosaic props

  • resize: 'DISABLED' or { minimumPaneSizePercentage?, minimumPaneSizePx?, renderSplitHandle?, preview? }. preview: true only moves the divider while dragging and resizes once on release.
  • dropBehavior: 'split' (default), 'swap', or 'split-and-swap'.
  • zeroStateView: element shown when the tree is null.
  • className: default 'mosaic-blueprint-theme'. Blueprint is optional; for Blueprint dark mode use 'mosaic-blueprint-theme bp5-dark' and load Blueprint's CSS. With your own theme, pass your own class name.
  • mosaicId: set a fixed one when external drag sources must drop into the layout.

Drag and drop

Mosaic sets up react-dnd itself (HTML5 + touch). If the app already has a DndProvider, render MosaicWithoutDragDropContext (same props) inside it instead of nesting a second provider, and share one copy of react-dnd 16. External drops use drag type MosaicDragType.WINDOW; drop targets outside the layout can return { remove: true } to take the dragged window out. Docs: https://nomcopter.github.io/react-mosaic/docs/guides/drag-and-drop

Common mistakes

  • v6 shapes: { direction, first, second }, splitPercentage, ['first'] paths. Use type: 'split', children, splitPercentages, numeric paths.
  • Forgetting the CSS import, or a parent with no height.
  • Passing both value and initialValue, or value without onChange.
  • Mutating the tree (tree.children.push(...)) instead of returning a new one.
  • Saving on every onChange during a resize drag; persist in onRelease.
  • splitPercentages whose length differs from children or doesn't sum to 100.
  • Duplicate keys in the tree, or nesting a tabs node inside tabs.
  • Hand-writing paths instead of using the path from renderTile / useMosaicWindow().mosaicWindowActions.getPath().

The TypeScript declarations in this package (index.d.ts) are the source of truth for every signature.

Häufig gestellte Fragen

Was macht der KI-Skill React Mosaic?

Build tiling window manager layouts in React with react-mosaic-component (v7) - resizable, drag-and-drop rearrangeable panels, splits and tab groups. Use when writing or changing code that imports react-mosaic-component, uses Mosaic / MosaicWindow / MosaicNode, or when asked for an IDE-like, dockable, resizable or tiled panel layout in React.

Warum React Mosaic in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. React Mosaic besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich React Mosaic in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/nomcopter/react-mosaic/tree/master/skills/react-mosaic ein. TypingMind liest die Datei SKILL.md und installiert den Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können React Mosaic nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit React Mosaic verwenden?

So viele Sie möchten. In TypingMind können Sie React Mosaic mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill React Mosaic kostenlos?

Der Skill wird von nomcopter auf GitHub veröffentlicht. Prüfen Sie im Repository, ob dort Lizenzbedingungen angegeben sind. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇