Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Vuepress Support #393

@HoukasaurusRex

Description

@HoukasaurusRex

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 found
  • Injection "$chakraColorMode" not found
  • Error 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

No one assigned

    Labels

    type: documentation 📚Improvements or additions to documentationtype: tooling 🛠Has to do with support modules that enhance the development experience with Chakra UI Vue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions