Extending slidehtml
English · Deutsch · 简体中文 · 繁體中文
Deck authors never modify templates. This page is for changes to the kit itself. See also CONTRIBUTING.md.
Adding a template
Add a template only when a kind of content keeps recurring and no existing template can hold it.
- Create the component in
src/kit/. Its props extendSlideBase; useSlideHead/SlideFootfor the shared header and footer. - Put styles in the matching stylesheet under
src/styles/. Use onlyuunits (24u= 24 px on the 1920×1080 design) and the colour variables from:root. Accent colours are alwaysvar(--accent),var(--accent-ink),var(--accent-wash),var(--accent-soft), orrgb(var(--accent-rgb) / 0.16)for transparency; hard-coded colours won’t follow theme changes. Inlinestyleonly takes unitless values or CSS variables. - Export it from
src/kit/index.tsand register it insrc/kit/catalog.ts: good for, avoid, content limits, props and an example. The catalog is the single source for the template docs. - Add a slide demonstrating it to a reference deck and point
demo(anddeck, if not the default deck) at that slide id. - For step-by-step reveals, put
data-buildon the outermost element of each item (same value for elements that appear together). For a number that appears on adjacent slides, give both the samedata-morph. - Run
npx slidehtml docsto regeneratedocs/*/components.mdandskills/slidehtml/references/, thennpx slidehtml check <deck>.
Adding a style preset
- Add an entry to
STYLESinsrc/kit/theme.ts(larger presets live insrc/kit/styles/<name>.ts): label, note (what it looks like and what it’s good for), optionalradius,papercolours andtone: 'dark'if the whole style is dark by default. - A style changes only title typography, radius, paper and decoration. Body text, sizes and spacing must stay the same so every template’s content limits remain valid.
- Add an example deck in a neutral topic (no real brands, products or company data) and check it at
#/kit/styles. - Run
npx slidehtml docs(updatesskills/slidehtml/references/styles.md), thencheck.
Adding a colour theme: add an entry to THEMES in src/kit/theme.ts and fill every field (soft is used on dark backgrounds, paper tints the background).
Icons
Icons come from the bundled icon set; the curated list is src/kit/icon-set.ts. To add one, add a line to the right group there. Name it after what it depicts. Type checking and the icon index update automatically.
QA rules
- A change is finished when
npx slidehtml check <deck>ends withPASSfor the affected decks and you have reviewed the screenshots inqa/. - Minimum font size is 17u; QA fails below that.
- No remote resources (fonts, images, scripts); the build fails on them.
- Don’t add global keyboard listeners; they break navigation.
- Templates must work at all four QA window sizes and, if listed for
tone: 'dark', on dark slides. - Example content stays neutral: no real brand names, logos or company data.