Skip to content
Kunkun

React

NPM Package: @kksh/react NPM Version

Original Shadcn: https://ui.shadcn.com/

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

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

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

import { Button } from "@/components/ui/button"
import { Button } from "@kksh/react"

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/react requires <ThemeProvider /> and <ThemeWrapper /> components to be wrapped around the root component.

  • <ThemeProvider /> is responsible for dark/light mode switching
  • <ThemeWrapper /> is responsible for setting the color theme
import { ui } from "@kksh/api/ui/iframe"
import { updateTheme } from "@kksh/react"
useEffect(() => {
ui.getTheme().then((theme) => {
updateTheme(theme)
})
}, [])
return (
<ThemeProvider defaultTheme="dark" storageKey="kk-ui-theme">
<ThemeWrapper>
<main>
...
</main>
</ThemeWrapper>
</ThemeProvider>
)

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

styles.css
@import url("@kksh/react/css");
@import url("@kksh/react/themes");
Sample Theme Customizer