Skip to content
Theme UI
GitHub

useThemeUI

To access the context object directly in a component, use the useThemeUI hook.

import React from 'react'
import { useThemeUI } from 'theme-ui'
export default props => {
const context = useThemeUI()
const { theme, colorMode, setColorMode } = context
return <pre>{JSON.stringify(theme, null, 2)}</pre>
}
Edit the page on GitHub
Previous:
MDX Components
Next:
API