Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
"guides/accessibility",
"guides/content-types",
"guides/content-templates",
"guides/custom-layouts",
"guides/improving-docs",
"guides/internationalization",
"guides/linking",
Expand Down
234 changes: 234 additions & 0 deletions guides/custom-layouts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
---
title: "Build custom page layouts"
sidebarTitle: "Custom page layouts"
description: "Use page modes and components to create landing pages, marketing pages, and other custom layouts."
keywords: ["landing page", "page mode", "custom mode", "frame mode", "hero section", "landing pages"]
---

Mintlify pages use a standard layout by default, with a sidebar, content area, and table of contents. Customize this layout with [page modes](/organize/pages#page-mode) to create landing pages, feature showcases, or any page that needs a unique design.

This guide covers how to use page modes, Tailwind CSS, and components to build custom layouts.

## Choose a page mode

Set the `mode` field in your page's frontmatter to control which UI elements appear.

| Mode | Sidebar | Table of contents | Footer | Theme support | Best for |
|------|---------|-------------------|--------|---------------|----------|
| `default` | Yes | Yes | Yes | All themes | Standard documentation pages |
| `wide` | Yes | No | Yes | All themes | Pages without headings or needing extra width |
| `custom` | No | No | No | All themes | Landing pages, marketing pages, or full-canvas layouts |
| `frame` | Yes | No | Modified | Aspen, Almond, Luma, Sequoia | Custom content that still needs sidebar navigation |
| `center` | No | No | Yes | Mint, Linden, Willow, Maple | Changelogs, focused reading experiences |

For landing pages, `custom` mode gives you the most control. It removes all UI elements except the top navbar, giving you a blank canvas to build on.

```yaml Example page frontmatter
---
title: "Welcome"
mode: "custom"
---
```

## Build a landing page

A typical landing page combines a hero section, feature cards, and calls to action.

### Set up the page

Create an MDX file with `custom` mode:

```yaml Example landing page frontmatter
---
title: "Documentation"
description: "Everything you need to build with our platform."
mode: "custom"
---
```

### Create a hero section

Use HTML with Tailwind CSS classes to build a centered hero section:

```mdx Example hero section
<div className="px-4 py-16 lg:py-32 max-w-3xl mx-auto text-center">
<h1 className="text-4xl font-medium text-gray-900 dark:text-zinc-50 tracking-tight">
Documentation
</h1>
<p className="mt-4 text-lg text-gray-500 dark:text-zinc-500">
Everything you need to build, deploy, and scale your application.
</p>
</div>
```

<Tip>
Include both light and dark mode styles. Use `dark:` prefixed Tailwind classes to handle dark mode.
</Tip>

### Add navigation cards

Use the [Card](/components/cards) and [Columns](/components/columns) components to create a grid of links below the hero section:

```mdx Example navigation cards
<div className="max-w-4xl mx-auto px-6">
<Columns cols={2}>
<Card title="Quickstart" icon="rocket" href="/quickstart">
Get up and running in under five minutes.
</Card>
<Card title="API reference" icon="code" href="/api-reference">
Explore endpoints, parameters, and examples.
</Card>
<Card title="Guides" icon="book" href="/guides">
Step-by-step tutorials for common tasks.
</Card>
<Card title="Components" icon="puzzle" href="/components">
Reusable UI components for your docs.
</Card>
</Columns>
</div>
```

### Use images with dark mode support

Show different images for light and dark mode using Tailwind's visibility classes:

```mdx Example images with dark mode support
<img
src="/images/hero-light.png"
alt="Platform overview showing the main dashboard."
className="block dark:hidden"
/>
<img
src="/images/hero-dark.png"
alt="Platform overview showing the main dashboard."
className="hidden dark:block"
/>
```

## Use React components for interactive layouts

For reusable or interactive elements, define [React components](/customize/react-components) directly in your MDX file:

```mdx Example React component
export const FeatureCard = ({ title, description, href }) => (
<a className="group block p-6 rounded-xl border border-gray-200 dark:border-zinc-800 hover:border-gray-300 dark:hover:border-zinc-700 transition-colors" href={href}>
<h3 className="font-medium text-gray-900 dark:text-zinc-50 group-hover:underline">
{title}
</h3>
<p className="mt-2 text-sm text-gray-500 dark:text-zinc-500">
{description}
</p>
</a>
);

<div className="max-w-4xl mx-auto px-6 grid sm:grid-cols-2 gap-4">
<FeatureCard
title="Authentication"
description="Set up OAuth, API keys, and session management."
href="/guides/authentication"
/>
<FeatureCard
title="Webhooks"
description="Receive real-time notifications for events."
href="/guides/webhooks"
/>
</div>
```

<Warning>
Avoid using the `style` prop on HTML elements. It can cause a layout shift on page load. Use Tailwind CSS classes or a [custom CSS file](/customize/custom-scripts) instead.
</Warning>

## Add custom CSS

For styles that Tailwind doesn't cover, add a CSS file to your repository. Mintlify applies CSS files site-wide, making their class names available in all MDX files.

<Note>
Tailwind CSS arbitrary values (for example, `w-[350px]`) are not supported. Use a custom CSS file for values that Tailwind's utility classes don't cover.
</Note>

```css Example custom CSS file
.landing-hero {
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
padding: 4rem 2rem;
}

@media (prefers-color-scheme: dark) {
.landing-hero {
background: linear-gradient(135deg, #0c1222 0%, #1a1a2e 100%);
}
}
```

Then reference the class in your MDX:

```mdx Example custom CSS usage
<div className="landing-hero">
<h1>Welcome to the docs</h1>
</div>
```

See [Custom scripts](/customize/custom-scripts) for more on custom CSS and the available CSS selectors.

## Full example

Here's a complete landing page that combines a hero section with navigation cards:

````mdx Example landing page
---
title: "Documentation"
description: "Everything you need to build with our platform."
mode: "custom"
---

export const HeroCard = ({ title, description, href, icon }) => (
<a className="group block p-6 rounded-xl border border-gray-200 dark:border-zinc-800 hover:border-gray-300 dark:hover:border-zinc-700 transition-colors" href={href}>
<h3 className="font-medium text-gray-900 dark:text-zinc-50">
{title}
</h3>
<p className="mt-2 text-sm text-gray-500 dark:text-zinc-500">
{description}
</p>
</a>
);

<div className="px-4 py-16 lg:py-32 max-w-3xl mx-auto text-center">
<h1 className="text-4xl font-medium text-gray-900 dark:text-zinc-50 tracking-tight">
Documentation
</h1>
<p className="mt-4 text-lg text-gray-500 dark:text-zinc-500 max-w-xl mx-auto">
Everything you need to build, deploy, and scale your application.
</p>
</div>

<div className="max-w-4xl mx-auto px-6 pb-16 grid sm:grid-cols-2 gap-4">
<HeroCard
title="Quickstart"
description="Get up and running."
href="/quickstart"
/>
<HeroCard
title="API reference"
description="Explore endpoints, parameters, and examples."
href="/api-reference"
/>
<HeroCard
title="Guides"
description="Step-by-step tutorials for common tasks."
href="/guides"
/>
<HeroCard
title="SDKs"
description="Client libraries for every major language."
href="/sdks"
/>
</div>
````

## Tips

- **Test light and dark mode.** Preview your custom layout in both light and dark mode to catch missing `dark:` styles.
- **Use `max-w-*` classes** to constrain content width and keep text readable.
- **Keep it responsive.** Use Tailwind's responsive prefixes (`sm:`, `md:`, `lg:`) so your layout works on all screen sizes.
- **Combine modes.** Use `custom` mode for your docs home page and `default` mode for everything else. You set the mode per page, so different pages can use different layouts.
- **Check for layout shifts.** If elements jump on page load, replace inline `style` props with Tailwind classes or custom CSS.
1 change: 1 addition & 0 deletions guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Make your documentation best in class.
- [Accessibility](/guides/accessibility): Make your docs accessible to as many users as possible.
- [Content types](/guides/content-types): Choose the right format for tutorials, how-tos, references, and explanations.
- [Content templates](/guides/content-templates): Copy and modify templates for each content type.
- [Custom page layouts](/guides/custom-layouts): Use page modes and components to build landing pages and other custom layouts.
- [Improve your docs](/guides/improving-docs): Use data and feedback to continuously improve your documentation.
- [Internationalization](/guides/internationalization): Set up multi-language documentation to reach global audiences.
- [Linking](/guides/linking): Create internal links, reference API endpoints, and maintain link integrity across your documentation.
Expand Down
6 changes: 3 additions & 3 deletions organize/pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ mode: "custom"
```

<Warning>
The `style` property on custom mode pages may cause a layout shift on page load. Prefer [Tailwind CSS or custom CSS](/customize/custom-scripts) to avoid this issue.
The `style` property may cause a layout shift on page load. Prefer [Tailwind CSS or custom CSS](/customize/custom-scripts) to avoid this issue.
</Warning>

### Frame

Frame mode provides a layout similar to custom mode but keeps the sidebar navigation. Use this mode to include custom HTML and components while preserving the default navigation experience. Only Aspen, Almond, and Luma themes support frame mode.
Frame mode provides a layout similar to custom mode but keeps the sidebar navigation. Use this mode to include custom HTML and components while preserving the default navigation experience. Aspen, Almond, Luma, and Sequoia themes support frame mode.

```yaml
---
Expand All @@ -136,7 +136,7 @@ mode: "frame"

### Center

Center mode removes the sidebar and table of contents, and centers the content. Use center mode for changelogs or other pages where you want to place focus on the content. Mint and Linden themes support center mode.
Center mode removes the sidebar and table of contents, and centers the content. Use center mode for changelogs or other pages where you want to place focus on the content. Mint, Linden, Willow, and Maple themes support center mode.

```yaml
---
Expand Down
Loading