Basic Usage

Learn how to use all the MDX components in your documentation

Overview

This guide covers all the MDX components available for creating rich documentation.

Callouts

Callouts are used to highlight important information:

Cards

Cards are great for navigation and feature highlights:

Single Card

Single Card Example

Cards can contain rich content including text and links.

Card Groups

Feature One

Description of the first feature.

Feature Two

Description of the second feature.

Code Blocks

Code blocks support syntax highlighting:

Single Language

rust
fn main() {
    println!("Hello, Dioxus!");
}

With Filename

filename="main.rs"
use dioxus::prelude::*;

fn main() {
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        div { "Hello, World!" }
    }
}

Code Groups

fn greet(name: &str) {
    println!("Hello, {}!", name);
}

Tabs

Organize related content with tabs:

Install the package using your preferred package manager:

bash
cargo add dioxus

Steps

Steps provide sequential instructions:

1

First Step

Complete the first task in the sequence.

2

Second Step

Move on to the second task.

3

Final Step

Complete the final task to finish.

Accordions

Collapsible content sections:

Combining Components

You can combine components for rich documentation experiences:

1

Create Component

Define your Dioxus component:

rust
#[component]
    fn Button(label: String) -> Element {
        rsx! {
            button { class: "btn btn-primary", "{label}" }
        }
    }
2

Use Component

Use it in your application:

rust
rsx! {
        Button { label: "Click me" }
    }
Navigation