Choose a page mode
Set themode field in your page’s frontmatter to control which UI elements appear.
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.
Custom mode pages have no default typography. Native HTML elements such as <h2> and <p> render with browser default styles, so style them explicitly with Tailwind CSS classes.
Example page frontmatter
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 withcustom mode:
Example landing page frontmatter
Create a hero section
Use HTML with Tailwind CSS classes to build a centered hero section:Example hero section
Add navigation cards
Use the Card and Columns components to create a grid of links below the hero section:Example navigation cards
Use images with dark mode support
Show different images for light and dark mode using Tailwind’s visibility classes:Example images with dark mode support
Use React components for interactive layouts
For reusable or interactive elements, define React components directly in your MDX file:Example React component
The web editor’s live preview does not generate CSS for page-specific Tailwind classes, so custom layouts can look unstyled while you edit them. Check your styling with
mint dev, a preview deployment, or a production deployment. See Tailwind classes not applying in the editor’s live preview.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. Use a custom CSS file when you need keyframe animations, complex selectors, or styles that apply across many pages. For one-off values, use a Tailwind arbitrary value such asw-[350px] instead.
Example custom CSS file
Example custom CSS usage
Full example
Here’s a complete landing page that combines a hero section with navigation cards:Example landing page
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
custommode for your docs home page anddefaultmode 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
styleprops with Tailwind classes or custom CSS. - Style components directly. Components accept a
classNameprop, so you can adjust one instance without a wrapper element or a CSS override. See Style components with className.