Deckx

From pydantic/talks · View interactive version

Deckx is an AI agent skill from the GitHub repository pydantic/talks. Create a deck with deckx. Use when the user mentions "deckx", "deck" or "slides", asks to build a slide deck from MDX, asks to convert a brand palette into a deck stylesheet, or asks how to convert a deckx HTML deck into a PDF. Covers project layout, deckx.toml config, deck.mdx authoring, custom Rea

How to use this skill

Skill file

deckx

deckx builds a single, self-contained HTML slide deck from one MDX file plus a CSS theme and an optional folder of React components. The HTML is print-ready and converts to PDF via Chrome headless.

Installation

bun init -y  # if you don't already have a package.json initialized
bun add @samuelcolvin/deckx

The npm package is @samuelcolvin/deckx; the installed CLI binary is deckx. npm i / pnpm add work the same way. Inside deck.mdx you always import from "deckx" (a Vite alias, not the npm name).

Project layout

my-deck/
├── deckx.toml          # config: title, theme, tabs, footer, paths (all optional)
├── deck.mdx            # the slides
├── styles.css          # CSS variable overrides (optional)
└── components/         # optional custom React/TSX components
    └── Hello.tsx
bunx deckx dev          # dev server with HMR on http://localhost:5173/
bunx deckx html         # build to ./dist/index.html
bunx deckx pdf          # build HTML, then ./dist/deck.pdf via Chrome headless

html and pdf accept an optional output-path positional - e.g. bunx deckx pdf my-deck.pdf or bunx deckx html out/slides.html. Use --dir <dir> to point at a build directory other than the current one. To convert an existing HTML file to PDF without rebuilding, use bunx deckx html-to-pdf <input.html> <output.pdf>.

`deckx.toml`

All fields are optional - a deck with only deck.mdx works.

title = "My Deck - April 2026"        # browser tab title

# light | dark | markdown-light | markdown-dark   (default: light)
# "markdown-*" variants render source-style decorations on top:
# heading "#"/"##" prefixes, "**" strong markers, traffic-light dots,
# mono slide counter, diamond bullets.
theme = "light"

# Small footer rendered bottom-right of every slide.
footer = "Confidential - do not share"

# Path to a favicon for the browser tab. .svg / .png / .ico / .jpg.
# Inlined as a data URI so the deck stays self-contained.
favicon = "assets/favicon.svg"

# Path overrides (defaults shown).
mdx = "deck.mdx"
styles = "styles.css"
components = "components"

# Optional tab nav. When present, <Slide tab="..."> highlights the matching tab.
tabs = [
  { id = "intro", label = "Intro" },
  { id = "details", label = "Details" },
]

If tabs is omitted, the tab prop on <Slide> is ignored and slides render with a plain title topbar.

`deck.mdx`

Standard MDX. Import Slide from "deckx", plus any custom components from ./components/.

import { Slide } from "deckx";
import Hello from "./components/Hello.tsx";

<Slide layout="title" title="Investor Deck / April 2026">

### Section Label

# My Deck

## A subtitle

</Slide>

<Slide tab="intro">

# Hello world

- Bullet one
- Bullet two

<Hello name="friend" />

</Slide>

<Slide layout="statement">

# One big idea.

</Slide>

Do NOT wrap slides in <div className="deck"> - deckx adds it for you.

`<Slide>` props

All props are optional. A bare <Slide> renders a regular content slide using the deck theme.

`layout` - structural layout (default `'content'`)

Picks how the slide arranges its body. Adds a .<value>-slide class to the .slide element so you can target each variant from styles.css.

`theme` - color variant (defaults to the deck theme)

Per-slide palette override.

There is no inverse override: on a light deck, theme="dark" has no effect. If you need a single dark slide on a light deck, target it from CSS with a custom id or class.

Other props

MDX gotchas

Images

Place images in your project (e.g. assets/) and import as ES modules:

import logo from "./assets/logo.png";
<img src={logo} alt="Logo" />

Vite inlines them into the final HTML. The markdown ![alt](path) syntax does not get inlined - always use <img src={imported} />.

Code blocks

Fenced code blocks are syntax-highlighted at build time by Shiki. Tag the fence with a language so tokens get coloured:

export function greet(name: string): string {

return hello, ${name};

}

All Shiki bundled languages work without any per-deck configuration. Highlighting happens during the build, so the output HTML carries only inline-styled <span>s - no grammar files, no runtime highlighter.

Both a light and a dark theme are emitted into every code block. deckx switches between them automatically based on the slide's effective theme: dark deck themes (dark, markdown-dark) use the dark code theme, and <Slide theme="light"> always shows the light code theme even inside a dark deck. Pick the two themes in deckx.toml:

code_light_theme = "github-light"   # default
code_dark_theme  = "github-dark"    # default

Browse the available themes at <https://shiki.style/themes>.

Custom components

Any .tsx file in components/ (or wherever deckx.toml components points) can be imported into deck.mdx with a relative path:

// components/Hello.tsx
export default function Hello({ name }: { name: string }) {
  return <p>Hello, {name}!</p>;
}
import Hello from "./components/Hello.tsx";
<Hello name="world" />

React 19 is available. Components see the same CSS variables your styles.css defines, so to stay on-brand, read from variables (color: var(--accent)) rather than hard-coding colors.

Authoring `styles.css`

The base stylesheet handles all layout, typography, slide dimensions, the topbar, transitions, and the PDF @page setup. styles.css only needs to override CSS variables on :root to set brand tokens.

Variable contract

Backgrounds:

Text:

Accents:

Fonts:

CSS class hooks

For finer control beyond the variable contract, target these classes from styles.css. Most decks won't need them - prefer overriding variables first.

Slide structure:

Slide modifiers (added to .slide based on props):

Topbar - left (traffic lights + title/tabs):

Topbar - tabs (rendered when <Slide tab="..."> is set and tabs are configured in deckx.toml):

Topbar - right (prev/next + counter):

Deck-level theme classes (applied to both <html> and .deck-presenter based on theme in deckx.toml):

MDX content inside .slide-body renders as plain HTML (h1-h4, p, ul, ol, pre, code, table, blockquote, a, img, hr) - target those tags directly with .slide <tag> selectors rather than expecting deckx to add wrapper classes.

Mapping a brand palette

  1. Pick the most distinctive brand color, assign to --accent. Pick a warm counterpoint as --accent-secondary.
  2. Pick a slightly off-white for --color-heading (pure white reads sterile under projector light).
  3. Pick a tinted dark for --bg-slide (pure black is harsh).
  4. For light slides, pick a tinted light bg (cream, eggshell, lavender - not pure white) plus a near-black text color → --bg-light / --color-heading-light / --color-text-light.
  5. For custom fonts, self-host woff2 files in assets/ and declare them with @font-face in styles.css, then point --font-body / --font-mono at the family. Do not use @import url(...) from Google Fonts - CSS spec requires @import to come before all other statements, which Vite's CSS bundling routinely violates when concatenating the base stylesheet with yours. @font-face can appear anywhere. Use Google Webfonts Helper to download woff2 files; Vite inlines them into the deck, keeping it self-contained for offline / PDF export.
@font-face {
  font-family: 'YourFont';
  src: url('./assets/YourFont-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg-slide: #...;       /* tinted dark */
  --bg-light: #...;       /* tinted light */
  --surface: #...;

  --color-heading: #...;  /* off-white */
  --color-text: rgba(...);
  --color-heading-light: #...;
  --color-text-light: #...;

  --accent: #...;            /* signature brand color */
  --accent-secondary: #...;  /* warm counterpoint */

  --font-body: 'YourFont', system-ui, sans-serif;
  --font-mono: 'YourFontMono', ui-monospace, monospace;
}

Building & PDF

bunx deckx pdf is the easy path: it builds the HTML, prints the exact Chrome command it's about to run, then runs it. Output lands at ./dist/deck.pdf.

If Chrome / Chromium can't be found, copy the printed command and run it yourself with the right binary path. On Linux deckx auto-detects google-chrome, google-chrome-stable, chromium, or chromium-browser.

Paper size in the printed command matches the slide dimensions (11in × 6.1875in = 16:9). If you override --slide-width / --slide-height in styles.css, edit the --paper-* flags to match before running.

To spot-check the PDF (requires pdftoppm from poppler):

mkdir -p ./tmp && pdftoppm -r 100 ./dist/deck.pdf ./tmp/page -png

One PNG per slide lands in ./tmp/, gitignore that path.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.