Skip to content
Kunkun

Vue

NPM Package: @kksh/vue NPM Version

Original Shadcn Vue: https://www.shadcn-vue.com/

Normally, Shadcn components are imported from local @/components/ui directory.

Now you can import the components from @kksh/vue package.

Most of Shadcn components are exported from @kksh/vue package.

For now, @kksh/vue has some treeshaking issues, importing from @kksh/vue may potentially add all components to your bundle. I didn’t figure out how to fix it yet. If you are an expert in building Vue library, please help me. The source code is at https://github.com/kunkunsh/kunkun-components/tree/main/packages/vue.

The best way to import components from this library is to import from the subpackages, like @kksh/vue/button or @kksh/vue/command.

import { Button } from "@/components/ui/button"
import { Button } from "@kksh/vue/button"
// Or
import { Button } from "@kksh/vue" // no treeshaking

Component Examples

Button Example

Command Palette Example

Theme

You can get KK’s color theme and set your extension theme to match KK’s theme.

@kksh/vue’s updateTheme() function set the theme globally, there is no need for a ThemeProvider.

import { ui } from "@kksh/api/ui/iframe"
import { updateTheme } from "@kksh/vue"
ui.getTheme().then((theme) => {
updateTheme(theme)
})

For color theme to take effect, you need to import the theme styles from @kksh/vue/themes.

styles.css
@import url("@kksh/vue/css");
@import url("@kksh/vue/themes");