The View component provides conditional rendering for multi-view content. It only renders its children when its title matches the active view.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mintlify/components/llms.txt
Use this file to discover all available pages before exploring further.
Basic Usage
Props
The title of this view. Must match one of the titles in the
items array to be visible.Array of view items from the multi-view context. Each item should have a
title and active property.Type definition:This prop is typically passed automatically from the MDX context when using Views in Mintlify documentation. You generally don’t need to provide this manually.
Additional CSS classes to apply to the view wrapper.
The content to display when this view is active.
How It Works
The View component:- Waits for the component to mount (prevents hydration mismatches)
- Checks if any item in the
itemsarray has a matchingtitleand is marked asactive - Only renders children when both conditions are met
- Returns
null(nothing) when the view is not active
Usage in MDX
In Mintlify documentation, Views are typically used with code blocks or content that should be shown conditionally. Views work with CodeGroup to show different content based on the selected tab.Styling
The View component automatically applies:- Prose styling (
prose dark:prose-invert) for rich content - A multi-view item class for internal tracking
- Custom classes via the
classNameprop
Important Notes
TypeScript
Full type safety is provided:Source Code Reference
- View component: packages/components/src/components/view/view.tsx:17
- ViewProps type: packages/components/src/components/view/view.tsx:8