Layer stack

Manages supplied layer selection, visibility, locking, and order through named 44px controls and caller-owned changes.

Layers

  1. Visible · Unlocked
  2. Visible · Locked

Keep the composition ordered

Cover art

Layers

  1. Visible · Unlocked
  2. Visible · Unlocked
  3. Visible · Locked

Use it for

  • Top-to-bottom layer order for a graphics, audio, or video editor.
  • onLayersChange receives the proposed array; the application applies it and owns persistence.
  • onSelect independently controls selection; locked layers cannot use their move actions.

Not for

  • Implying drag-and-drop support or modifying document content behind the host's back.
  • Rendering state-changing controls without onLayersChange.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

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.

2. Vendor the source

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.

3. Through shadcn

npx shadcn add https://vlak.dev/r/layer-stack.json

The same registry item, installed by shadcn's CLI.

CSS only

<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} />;
}

LayerStack

A controlled layer order with explicit selection, visibility, lock and move actions.

PropTypeDefaultDescription
labelrequiredReactNode
layersrequiredCreativeLayer[]Ordered from top to bottom.
selectedIdstring | null
onSelect(id: string) => void
onLayersChange(layers: CreativeLayer[]) => void
disabledboolean

Also accepts Omit<HTMLAttributes<HTMLDivElement>, "onSelect">.

KeysDoes
TabMoves through available layer selection and Vlak visibility, lock, and move buttons.
Enter, SpaceRequests 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>
.rs-layer-stack.rs-layer-stack-label.rs-layer-stack-list.rs-layer-stack-row.rs-layer-stack-actions.rs-layer-stack-action.rs-layer-stack-button.rs-layer-stack-selected.rs-layer-stack-note