excalidraw
БесплатноБез исполняемых скриптовНе проверенExcalidraw is an open-source virtual whiteboard, shipped as a React component, for hand-drawn style diagrams. Use it to embed a whiteboard in a React or…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Excalidraw — Hand-Drawn Whiteboard SDK
Overview
Excalidraw is an open-source whiteboard that ships on npm as @excalidraw/excalidraw, a React component (latest stable 0.18.1; React 17, 18 and 19 are supported peers). It stores a scene as a plain JSON array of elements, so diagrams can be drawn by hand, generated from code, converted from Mermaid, exported as PNG/SVG, and kept in git as .excalidraw files.
Three things changed in 0.18 and break older snippets: the stylesheet must be imported explicitly, the ref prop was replaced by an excalidrawAPI callback prop, and types moved to @excalidraw/excalidraw/types and @excalidraw/excalidraw/element/types. The editor needs a browser, so it cannot render on the server.
Instructions
Install and embed
npm install react react-dom @excalidraw/excalidraw
// src/components/Whiteboard.tsx
import { useState } from "react";
import { Excalidraw } from "@excalidraw/excalidraw";
import "@excalidraw/excalidraw/index.css";
import type { ExcalidrawImperativeAPI, AppState } from "@excalidraw/excalidraw/types";
import type { OrderedExcalidrawElement } from "@excalidraw/excalidraw/element/types";
export function Whiteboard() {
const [api, setApi] = useState<ExcalidrawImperativeAPI | null>(null);
const onChange = (elements: readonly OrderedExcalidrawElement[], state: AppState) => {
// fires on every pointer move while drawing: debounce before saving
console.log(`${elements.length} elements, tool: ${state.activeTool.type}`);
};
return (
<div style={{ height: "100vh", width: "100%" }}>
<Excalidraw
excalidrawAPI={(instance) => setApi(instance)}
onChange={onChange}
initialData={{ appState: { viewBackgroundColor: "#fafafa" }, scrollToContent: true }}
UIOptions={{ canvasActions: { loadScene: true, export: { saveFileToDisk: true } } }}
/>
</div>
);
}
The component fills 100% of its parent, so the parent needs a non-zero height. Fonts are fetched from a CDN by default; to self-host, copy the contents of node_modules/@excalidraw/excalidraw/dist/prod/fonts into your public folder and set window.EXCALIDRAW_ASSET_PATH = "/" before the editor loads.
Next.js (App Router)
Excalidraw touches window, so load it client-side only:
// app/board/page.tsx
"use client";
import dynamic from "next/dynamic";
import "@excalidraw/excalidraw/index.css";
const Excalidraw = dynamic(
async () => (await import("@excalidraw/excalidraw")).Excalidraw,
{ ssr: false },
);
export default function BoardPage() {
return <div style={{ height: "100vh" }}><Excalidraw /></div>;
}
For anything besides the Excalidraw component (helpers like convertToExcalidrawElements), put them in a wrapper component and import that wrapper dynamically.
Generate elements with the skeleton API
Do not hand-write full element objects (they need seed, version, versionNonce, index, and more). Write skeletons and let convertToExcalidrawElements fill in the rest, including bound text and arrow bindings:
// src/diagrams/architecture.ts
import { convertToExcalidrawElements } from "@excalidraw/excalidraw";
const fills: Record<string, string> = {
api: "#a5d8ff", database: "#b2f2bb", queue: "#ffec99", cache: "#ffc9c9", frontend: "#d0bfff",
};
type Service = { id: string; label: string; kind: keyof typeof fills; x: number; y: number };
export function architectureElements(services: Service[], links: [string, string][]) {
return convertToExcalidrawElements([
...services.map((s) => ({
type: "rectangle" as const,
id: s.id,
x: s.x,
y: s.y,
width: 200,
height: 80,
backgroundColor: fills[s.kind],
fillStyle: "solid" as const,
roughness: 1,
roundness: { type: 3 as const },
label: { text: `${s.label}\n(${s.kind})`, fontSize: 16 },
})),
...links.map(([from, to]) => ({
type: "arrow" as const,
x: 0,
y: 0,
start: { id: from },
end: { id: to },
endArrowhead: "arrow" as const,
})),
]);
}
// api.updateScene({ elements: architectureElements(services, links) });
// api.scrollToContent(undefined, { fitToContent: true });
Arrows with start/end ids are positioned and bound to the shapes automatically. Other skeleton types include ellipse, diamond, text, line, image, frame and, in the unreleased master branch, stickynote.
Mermaid to Excalidraw
@excalidraw/mermaid-to-excalidraw (the package behind the editor's Mermaid dialog) turns Mermaid text into skeleton elements; flowcharts are converted to editable shapes:
import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
import { convertToExcalidrawElements } from "@excalidraw/excalidraw";
const { elements, files } = await parseMermaidToExcalidraw(
"flowchart LR\n Browser --> API --> Postgres",
);
api.updateScene({ elements: convertToExcalidrawElements(elements)
Установить excalidraw в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл excalidraw?
Excalidraw is an open-source virtual whiteboard, shipped as a React component, for hand-drawn style diagrams. Use it to embed a whiteboard in a React or Next.js app, generate diagrams from code or Mermaid text, export PNG/SVG/.excalidraw files, or wire up collaboration. Triggers - "add Excalidraw to my app", "generate an architecture diagram", "export a diagram as SVG".
Как установить скилл excalidraw?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл excalidraw запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic