Theme API
VitePress themes are defined using a standard interface and can extend the default theme or create completely custom layouts.Theme Interface
Theme Object
A VitePress theme is defined as an object with the following interface:Component
The root layout component for your theme
(ctx: EnhanceAppContext) => Awaitable<void>
Function to enhance the Vue app instance
Theme
Another theme to extend from
() => void
Theme-level setup function (deprecated - use Layout component setup instead)
Component
Custom 404 component (deprecated - check
useData().page.value.isNotFound in Layout)EnhanceAppContext
The context object passed toenhanceApp:
Default Theme
The default theme can be imported fromvitepress/theme.
Importing the Default Theme
Without Fonts
Import the default theme without Inter font:Default Theme Components
The default theme exports several components you can use in your custom theme or markdown:Layout Components
VPBadge
Display a badge with different styles.'info' | 'tip' | 'warning' | 'danger'
default:"tip"
Badge color theme
string
Badge text content
VPButton
Stylized button component.'brand' | 'alt' | 'sponsor'
Button style theme
string
Button text
string
Link URL
'small' | 'medium' | 'big'
default:"medium"
Button size
VPImage
Responsive image component with light/dark mode support.string | { light: string, dark: string }
required
Image source URL or theme-specific URLs
string
required
Alternative text for the image
Home Page Components
VPHomeHero
Hero section for home pages.VPHomeFeatures
Features grid for home pages.VPHomeContent
Wrapper for custom home page content.VPHomeSponsors
Display sponsors on the home page.Team Components
VPTeamPage
Wrapper component for team pages.VPTeamPageTitle
Title section for team pages.VPTeamPageSection
Section wrapper for grouping team members.VPTeamMembers
Display team member cards.TeamMember[]
required
Array of team member objects
'small' | 'medium'
default:"medium"
Size of member cards
Social Components
VPSocialLinks
Display a group of social media links.VPSocialLink
Single social media link icon.string | { svg: string }
required
Icon name or custom SVG
string
required
URL to link to
string
Accessibility label
discordfacebookgithubinstagramlinkedinmastodonslacktwitteryoutubex
Other Components
VPSponsors
Display sponsor logos in a grid.VPDocAsideSponsors
Sponsors section for the aside/sidebar.carbonAds or sidebar.sponsors.
VPFeatures
Alternative features component.Default Theme Composables
useLayout
Access layout state and computed properties.ComputedRef<boolean>
Whether the current page is the home page
Ref<SidebarItem[]>
Current sidebar items
ComputedRef<SidebarItem[]>
Grouped sidebar items
ComputedRef<boolean>
Whether sidebar should be displayed
ComputedRef<boolean>
Whether sidebar is enabled at current viewport
ComputedRef<boolean>
Whether aside/outline should be displayed
ComputedRef<boolean>
Whether aside is positioned on the left
Ref<OutlineItem[]>
Page outline/headers
Whether local navigation should be shown