Skip to content
Kunkun

Svelte

NPM Package: @kksh/svelte NPM Version

Original Shadcn Svelte: https://www.shadcn-svelte.com/

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

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

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

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/svelte requires <ThemeWrapper /> component to be wrapped around the root component.

<script>
import { ui } from "@kksh/api/ui/iframe"
import { updateTheme } from "@kksh/svelte"
onMount(() => {
ui.getTheme().then((theme) => {
updateTheme(theme)
})
})
</script>
<ThemeWrapper>
<main>
...
</main>
</ThemeWrapper>

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

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