StyleProvider

The StyleProvider component is an extension of the ComponentProvider component that includes default styles for MDX components with support for theming.

// example Root component
import React from 'react'
import { StyleProvider } from 'mdx-go'

export const Root = props =>
  <StyleProvider>
    {props.children}
  </StyleProvider>

Theming

Custom themes can be passed to the StyleProvider with the theme prop.

<StyleProvider
  theme={theme}
/>

Props

PropTypeDescription
themeobjecttheme
componentsobjectMDX component scope
fontSizenumber, string, or arrayBase font size
fontFamilystringBase font family
colorstringBase text color
bgstringBase background color
cssobject or stringAdditional CSS to pass to the root element