Developer Guide
Documentation for developers working on LCARdS itself: adding cards, options, editors, packs and core services, and the APIs they use. Everything lives in one repository and ships as one bundle, so these guides are about changing that code; there is no plugin API for cards or packs shipped separately. How the pieces work inside is in the Architecture section.
How-to Guides
| Page | Description |
|---|---|
| Building a Custom Card | Extend LCARdSCard, the schema, registration in src/lcards-main.js, element types, card size, build and test |
| Adding a Card Option | A new or changed YAML key end to end: schema, runtime, editor, docs, registries and tests |
| Building a Studio Editor | Studio dialogs (the dialog pattern, live preview, the shared panels and controls, launching from the card editor), plus a basic LCARdSBaseEditor card editor |
| Building a Pack | Style presets, components, themes, rules, assets and sound schemes in a built-in pack |
| Adding a Core Service | A BaseService singleton: startup order, HASS distribution, debug info, tests and docs |
| Testing | The test layers (node, browser, visual, real Home Assistant, docs site), their helpers and when to use each |
| Type Checking | How TypeScript checks our JavaScript, the rules for new code, and how to fix common errors |
| Colour Resolution | Resolving colours, theme tokens and computed expressions (darken, lighten, alpha, ...) in CSS, SVG, Canvas2D and anime.js |
API Reference
| Page | Description |
|---|---|
| Animation API | window.lcards.anim.*: anime.js v4 access, helpers, presets, scopes |
| Assets and SVG API | Font loading, SVG cache, SVG and anchor helpers, text measure cache |
| Backend WS API | lcards/* WebSocket commands and the integration's actions: storage, Home Assistant service targeting, degraded mode |
| Debug API | Console introspection: log level, core singletons, MSD cards, data sources |
| Helpers API | LCARdS's own helper registry: the input_* helpers it creates, reads, writes and watches |
CSS and Theming
| Page | Description |
|---|---|
| Home Assistant CSS Variables | The Home Assistant CSS variables LCARdS uses (minimum Home Assistant 2026.11), their default values and where LCARdS uses them |
Architecture
| Page | Description |
|---|---|
| Architecture overview | How the bundle, the integration, the core and the cards fit together |
| Card Foundation | LCARdSNativeCard and LCARdSCard: lifecycle, HASS flow, entities, rules, preview mode, cleanup |
| Core Subsystems | Every window.lcards.core.* service, the startup order and how HASS reaches them |
Build, test and release
The commands are kept in one place, COOKBOOK.md in the repository root (not on this site): its sections are Daily loop (build, hard refresh, tests, docs server), npm scripts (every script, and which ones npm run build already runs), Tests, CI workflows, Docs site and Releases. npm run help prints the same script list in the terminal.
The short version:
npm run buildis the only build, for development and releases alike. It runs every validator first (strict doc examples, schema descriptions, em dashes and "Home Assistant" in the docs, CSS variables, the Home Assistant compatibility lint, typecheck) and writes the bundle intocustom_components/lcards/. Hard-refresh the browser afterwards (Ctrl+Shift+R).npm testruns the node tests;npm run test:browserthe browser tests against the built bundle. CI runs both, plus the checks inside the build.npm run validate:config -- <file>checks any LCARdS YAML (a card, a view, a dashboard) with the same checker as the doc examples.- Code rules live in
CLAUDE.mdand.claude/rules/*.md; read the file for the area you change.