Skip to content
Quickstart

Quickstart

container-relative layout and pointer ownership

This illustrative example registers panes and asks Maosaico to tile them within the supplied bounds:

quickstart.tsx
import { MaosaicoRoot, useMaosaicoItem } from "@fungi.computer/maosaico";
function Pane({ id }: { id: string }) {
const pane = useMaosaicoItem({
id,
frame: { x: 0, y: 0, width: 320, height: 240 },
minima: { width: 180, height: 120 },
});
return (
<section
hidden={!pane.visible}
{...pane.props}
style={{
position: "absolute",
left: pane.frame.x,
top: pane.frame.y,
width: pane.frame.width,
height: pane.frame.height,
}}
>
Pane content stays mounted here.
</section>
);
}
function Workspace() {
return (
<div style={{ position: "relative", width: 1000, height: 600 }}>
<MaosaicoRoot bounds={{ width: 1000, height: 600 }} tiling={{ gap: 8 }}>
<Pane id="chat" />
<Pane id="files" />
</MaosaicoRoot>
</div>
);
}

This sketch is illustrative; the layout tests exercise the public React boundary and pane registration in test/tiling.test.tsx.