Skip to content

MDX components

Every block the blog can render, with the source that makes it.

Posts here are MDX. Markdown covers the text, and components cover the rest. This page shows each one next to the source that renders it, so it doubles as a reference.

Typography

Paragraphs set at 15px with a 28px line height. Bold and italic work, as do strikethrough, inline code and links. Links to other sites open in a new tab, like the MDX docs.

A blockquote sits behind a thin rule. Use it for quotes, not for warnings. Callouts are further down.

Lists

  • Unordered lists use a muted disc.
  • Items can nest:
    • like this one
    • and this one
  • Ordered lists count instead.
  1. Write the post.
  2. Read it once out loud.
  3. Cut a third of it.

Task lists

  • Code blocks with titles
  • Table of contents
  • Search

Headings

Every heading gets an id and a link. Hover one to see the #. The h2 and h3 headings also appear in the table of contents on the right.

A fourth-level heading

It renders, but it stays out of the table of contents.


Tables

ComponentBuilt onInteractive
TabsUI SDKYes
AccordionUI SDKYes
Code blockShikiNo
CalloutPlain JSXNo

Wide tables scroll sideways on phones, and the column alignment from the Markdown carries over.

Code

Fences go through Shiki at build time, so Shiki never ships to the browser. The colours come from the same palette the component pages use.

src/components/counter.tsx
import { createSignal } from "solid-js";

export const Counter = () => {
  const [count, setCount] = createSignal(0);

  return (
    <button onClick={() => setCount(count() + 1)} type="button">
      {count()}
    </button>
  );
};

A fence without a title gets a floating copy button.

.card {
  border-radius: 0.75rem;
  background: oklch(1 0 0 / 4%);
}

Highlights and diffs

Mark a line with a [!code highlight] comment, or show a change with [!code ++] and [!code --]. The markers vanish from the output.

vite.config.ts
export default defineConfig({
  plugins: [
    tanstackStart(),
    nitro({ preset: "bun" }),
    nitro({ cache: { driver: "fs" }, preset: "bun" }),
    solid({ ssr: true }),
  ],
});

Code tabs

Add tab="..." to consecutive fences to group them.

const [open, setOpen] = createSignal(false);

Package managers

An npm fence becomes a command for each package manager. The choice sticks across the page and across visits.

npm install sugar-high

Callouts

<Callout title="Heads up">The default type is `info`.</Callout>

Heads up

The default type is info.

Saved

Use success when something finished.

Breaking change

warn is for things that need attention before you continue.

Removed

error is for things that will not work.

idea suits tips. The title is optional.

Steps

Wrap ### headings in <Steps> to number them.

Install the CLI

npx shadcn@latest init

Add a component

npx shadcn@latest add https://olekaleksander.dev/r/code-block.json

Use it

Import it from @/components/ui/code-block and render it.

Tabs

<Tabs items={["Preview", "Notes"]}>
  <Tab value="Preview">...</Tab>
  <Tab value="Notes">...</Tab>
</Tabs>

Tabs hold any content, including other components.

A callout inside a tab.

Accordion

Cards

Files

mdx-components.mdx
router.tsx
vite.config.ts

Type table

PropTypeDefault
title

Shown in the header and the browser tab.

string–
date

Publish date, quoted, as YYYY-MM-DD.

string–
description

One line under the title and in the post list.

string–

Inline bits

Press ⌘ K to search, once search exists. Badges label things inline: New Solid

Footnotes collect at the end of the post.1 Each one links back to where it was cited.2

Images

The home page of this site
Figures take a caption.

Live components

Any example from the components page can run inside a post.

1,175 contributions in 2025
Contribution GraphView component
  • WarsawGMT+1
  • New YorkGMT-5
  • TokyoGMT+9
Local TimeView component

Footnotes

  1. Like this one. ↩

  2. The arrow after each footnote jumps back. ↩