Keep the composition ordered
Cover art
Layers
- Visible · Unlocked
- Visible · Unlocked
- Visible · Locked
Manages supplied layer selection, visibility, locking, and order through named 44px controls and caller-owned changes.
Layers
Cover art
Layers
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { LayerStack } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/layer-stack.
npx @noorddev/vlak-cli add layer-stack
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/layer-stack.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { useState } from "react";
import { LayerStack } from "@noorddev/vlak-react";
import type { CreativeLayer } from "@noorddev/vlak-react";
function Layers() {
const [layers, setLayers] = useState<CreativeLayer[]>([{ id: "title", label: "Title", visible: true, locked: false }, { id: "background", label: "Background", visible: true, locked: true }]);
const [selected, setSelected] = useState<string | null>(null);
return <LayerStack label="Layers" layers={layers} selectedId={selected} onSelect={setSelected} onLayersChange={setLayers} />;
}A controlled layer order with explicit selection, visibility, lock and move actions.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | ReactNode | ||
layersrequired | CreativeLayer[] | Ordered from top to bottom. | |
selectedId | string | null | ||
onSelect | (id: string) => void | ||
onLayersChange | (layers: CreativeLayer[]) => void | ||
disabled | boolean |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, "onSelect">.
| Keys | Does |
|---|---|
| Tab | Moves through available layer selection and Vlak visibility, lock, and move buttons. |
| Enter, Space | Requests the focused action; move buttons reorder one position when allowed. |
<div class="rs-layer-stack"><p class="rs-layer-stack-label">Layers</p><ol class="rs-layer-stack-list"><li class="rs-layer-stack-row"><span>Title</span><span class="rs-layer-stack-note">Visible · Unlocked</span></li><li class="rs-layer-stack-row"><span>Background</span><span class="rs-layer-stack-note">Visible · Locked</span></li></ol></div>