Lauro Silva
Lauro Silva
5 min read
MDX Component Gallery icon

MDX Component Gallery

Comprehensive guide showing all available MDX components with examples and usage instructions.

On this page

Welcome to our component gallery! This page demonstrates all available MDX components and how to use them in your content.

#Text Styling Components

#Emphasis

Here's how to use emphasis in your content.

_This text will be emphasized_

#Strong Text

You can make text bold and important like this:

**This text will be bold**

#Blockquotes

You can create beautiful blockquotes like this:

This is a blockquote. It's perfect for highlighting important information or displaying quotes from other sources.

You can have multiple paragraphs too!

> Your quote text goes here

#Lists

Here's how our custom lists look:

  • First item with custom bullet
  • Second item that shows animation
  • Third item with hover effect
    • Nested items work too
    • With consistent styling

#Info Boxes

💡

This is a standard info box. Use it for general information.

⚠️

This is a warning box. Use it for important cautions.

This is an error box. Use it for critical information.

This is a success box. Use it for positive outcomes.

<InfoBox type="info">Your message here</InfoBox>
<InfoBox type="warning">Warning message</InfoBox>
<InfoBox type="error">Error message</InfoBox>
<InfoBox type="success">Success message</InfoBox>

#Callouts

This is a callout with a lightbulb emoji. Perfect for tips and ideas!

This is a warning callout. Use it when you need to catch the reader's attention.

<Callout emoji="💡">Your callout text here</Callout>

#Code Examples

You can use inline code like this.

Or create code blocks:

function Example() {
	return (
		<div>
			<h1>Hello World</h1>
		</div>
	)
}

#Keyboard Shortcuts

You can show keyboard combinations like this: + S to save.

;<Kbd></Kbd> + <Kbd>S</Kbd>

#Demo Containers

This is a demo container. Use it to showcase examples or interactive components.

You can put any content here!

<Demo>Your demo content here</Demo>

#Tables

Tables are styled automatically:

ComponentUsageExample
InfoBoxInformation displayInfo, Warning, Error
CalloutAttention-grabbing notesTips, Warnings
KbdKeyboard shortcuts⌘ + S

#Horizontal Rules

Here's a fancy gradient horizontal rule:


#Images

Images get special treatment with rounded corners and hover effects:

Footprints Camp Recap: A Running + Climate Camp
Footprints Camp Recap: A Running + Climate Camp

#Combining Components

You can combine components for rich content:

💡

Here's how to combine components: - Use emphasized text - Add inline code - Include shortcuts

#Details Component

The Details component creates an expandable/collapsible section with a smooth animation. It's perfect for FAQs, additional information, or any content that should be hidden by default.

PropTypeDescription
titlestringThe text shown in the expandable header
childrenReactNodeThe content revealed when expanded

#Examples

Basic Example

This content is hidden by default and will be revealed when clicked.

With Multiple Elements

You can nest other MDX components inside Details!

Here's a list:

  • Item one
  • Item two

#StackBlitz Component

The StackBlitz component allows you to embed interactive code examples directly in your MDX content.

#Basic Example

#Component Props

PropTypeDefaultDescription
idstringrequiredThe StackBlitz project ID
heightstring500pxHeight of the embed
filestringsrc/App.tsxInitial file to open
view"preview" | "editor" | "both"bothLayout view mode
hideNavigationbooleantrueHide the top navigation bar
hideDevToolsbooleanfalseHide the bottom dev tools
hideExplorerbooleanfalseHide the file explorer
hideTerminalbooleanfalseHide the terminal
terminalHeightnumberundefinedTerminal height in pixels
devToolsHeightnumberundefinedDevTools height in pixels
theme"dark" | "light"darkEditor theme
clickToLoadbooleanfalseLoad on click instead of immediately

#Configuration Examples

#Editor View

#Preview Only View

#Custom Layout Example

#Implementation

// Basic usage

<StackBlitz id="vitejs-vite-ym2hon" />

// Custom configuration

<StackBlitz
	id="vitejs-vite-ym2hon"
	height="600px"
	file="src/main.tsx"
	view="editor"
	hideExplorer={true}
	theme="dark"
/>

// Preview focused

<StackBlitz
	id="vitejs-vite-ym2hon"
	view="preview"
	hideDevTools={true}
	hideTerminal={true}
/>

#Note

  1. Performance: Use clickToLoad={true} for pages with multiple embeds
  2. Height: Adjust height based on your content needs
  3. View Mode: Choose appropriate view mode for your use case:
    • editor: For code-focused examples
    • preview: For result-focused examples
    • both: For interactive tutorials
  4. Initial File: Set file prop to focus on specific code
  5. Theme: Match your site's theme using the theme prop

That's our complete component gallery! Check the source of this page to see exactly how each component is used.

#Best Practices

  1. Use appropriate components for their intended purpose
  2. Combine components thoughtfully
  3. Keep accessibility in mind
  4. Test your content in both light and dark modes