This repository was archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
Vuepress Support #393
Copy link
Copy link
Closed
Labels
type: documentation 📚Improvements or additions to documentationImprovements or additions to documentationtype: tooling 🛠Has to do with support modules that enhance the development experience with Chakra UI VueHas to do with support modules that enhance the development experience with Chakra UI Vue
Description
Is your feature request related to a problem? Please describe.
In Vuepress, there seems to be no straightforward way to begin using Chakra UI components.
Describe the solution you'd like
Either a simple solution provided in the documentation, or a dedicated plugin for Vuepress.
Describe alternatives you've considered
I've tried some hacky configurations in Vuepress's enhanceApp.js like:
import Chakra, { CThemeProvider, CColorModeProvider } from '@chakra-ui/vue'
const ChakraMixins = {
install(Vue, options) {
const { $chakraTheme, $chakraIcons } = CThemeProvider.provide()
const { $chakraColorMode, $toggleColorMode } = CColorModeProvider.provide()
Vue.prototype.$chakraTheme = $chakraTheme
Vue.prototype.$chakraColorMode = $chakraColorMode
Vue.prototype.$toggleColorMode = $toggleColorMode
Vue.prototype.$chakraIcons = $chakraIcons
}
}
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData, // site metadata
isServer // is this enhancement applied in server-rendering or client
}) => {
Vue.use(Chakra)
Vue.use(ChakraMixins)
}Or using mixins instead, but either way I get errors like
Injection "$chakraTheme" not foundInjection "$chakraColorMode" not foundError in render: "TypeError: Cannot read property 'colors' of undefined
Additional context
While the Chakra UI recommends adding the CThemeProvider in a render function, there seems no simple (or smooth) way to modify the one used in Vuepress. If anyone has implementation ideas or suggestions, would appreciate!
Metadata
Metadata
Assignees
Labels
type: documentation 📚Improvements or additions to documentationImprovements or additions to documentationtype: tooling 🛠Has to do with support modules that enhance the development experience with Chakra UI VueHas to do with support modules that enhance the development experience with Chakra UI Vue