Create a new MDX article with frontmatter, example embeds, and custom components. Use when writing in-depth UX guides or tutorials.
This skill helps you create in-depth UX guide articles using MDX.
Articles require 2 things:
src/pages/article/{slug}.mdxsrc/articles.tsOptionally, custom interactive components in src/components/articles/
Create src/pages/article/{slug}.mdx:
---
layout: "@/layouts/ArticleLayout.astro"
title: "Article Title"
description: "Brief description for SEO and article list"
---
import { ExampleEmbed } from "@/components/articles/ExampleEmbed";
# Article Title
Introduction paragraph explaining what this guide covers.
## Section 1
Content with **bold** and *italic* text.
<ExampleEmbed id="existing-example-id" client:load />
### Subsection
- Bullet points
- For key takeaways
## Section 2
More content...
export const articles: Article[] = [
// ... existing articles
{
slug: "my-article-slug", // Must match filename without .mdx
title: "Article Title",
description: "Brief description",
tags: ["Tag1", "Tag2"],
createdAt: "YYYY-MM-DD", // Today's date in ISO format
},
];
Use ExampleEmbed to include existing UX pattern examples:
import { ExampleEmbed } from "@/components/articles/ExampleEmbed";
<ExampleEmbed id="verification-code-input" client:load />
The id must match an existing example in src/examples/.
Important: Always add client:load for React components in MDX.
For complex interactive elements, create components in src/components/articles/:
src/components/articles/
āāā ExampleEmbed.tsx # Embed existing examples
āāā EmailComparison.tsx # Custom comparison component
āāā UltimateOtpDemo.tsx # Custom demo component
āāā ux-speed-game/ # Complex multi-file component
āāā index.tsx
āāā Game.tsx
āāā ...
Then import in your MDX:
import { MyCustomComponent } from "@/components/articles/MyCustomComponent";
<MyCustomComponent client:load />
#, ##, ### for headings**bold**, *italic*- item for bullet lists1. item for numbered lists`code` for inline codeclient:load for interactivity<Component />---
layout: "@/layouts/ArticleLayout.astro"
title: "Page title (shown in browser tab)"
description: "SEO description"
---
<ExampleEmbed /> to show patternsprose classes handle typography automatically--- (horizontal rules) are hidden by defaultCheck src/examples/index.ts for all available example IDs to embed.