pickstack

Svelte + shadcn-svelte

Tailwind components copied into your project (built on Bits UI). This page shows exactly what pickstack adds to a Svelte project for shadcn-svelte: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework svelte --modules shadcn-svelte --yes
Customize in the configurator

Packages it adds

PackageVersionType
@fontsource-variable/inter^5.3.0dev
@tailwindcss/vite^4.3.5dev
cn^0.5.2dev
shadcn-svelte^1.8.1dev
tailwind-variants^3.3.0dev
tailwindcss^4.3.5dev
tw-animate-css^1.4.0dev

New files

components.json
{
  "$schema": "https://shadcn-svelte.com/schema.json",
  "tailwind": {
    "css": "src/app.css",
    "baseColor": "neutral"
  },
  "aliases": {
    "components": "#lib/components",
    "utils": "#lib/utils",
    "ui": "#lib/components/ui",
    "hooks": "#lib/hooks",
    "lib": "#lib"
  },
  "typescript": true,
  "registry": "https://shadcn-svelte.com/registry",
  "style": "vega",
  "iconLibrary": "lucide",
  "menuColor": "default",
  "menuAccent": "subtle"
}
src/lib/components/ui/button/button.svelte
<script lang="ts" module>
  import type {
    HTMLAnchorAttributes,
    HTMLButtonAttributes,
  } from "svelte/elements";
  import { tv, type VariantProps } from "tailwind-variants";
  import { cn, type WithElementRef } from "#lib/utils.js";

  export const buttonVariants = tv({
    base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground hover:bg-primary/80",
        outline:
          "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",
        secondary:
          "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
        ghost:
          "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
        destructive:
          "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
        link: "text-primary underline-offset-4 hover:underline",
      },
      size: {
        default:
          "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
        sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
        lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        icon: "size-9",
        "icon-xs":
          "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
        "icon-sm":
          "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
        "icon-lg": "size-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  });

  export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
  export type ButtonSize = VariantProps<typeof buttonVariants>["size"];

  export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
    WithElementRef<HTMLAnchorAttributes> & {
      variant?: ButtonVariant;
      size?: ButtonSize;
    };
</script>

<script lang="ts">
  let {
    class: className,
    variant = "default",
    size = "default",
    ref = $bindable(null),
    href = undefined,
    type = "button",
    disabled,
    children,
    ...restProps
  }: ButtonProps = $props();
</script>

{#if href}
  <a
    bind:this={ref}
    data-slot="button"
    class={cn(buttonVariants({ variant, size }), className)}
    href={disabled ? undefined : href}
    aria-disabled={disabled}
    role={disabled ? "link" : undefined}
    tabindex={disabled ? -1 : undefined}
    {...restProps}
  >
    {@render children?.()}
  </a>
{:else}
  <button
    bind:this={ref}
    data-slot="button"
    class={cn(buttonVariants({ variant, size }), className)}
    {type}
    {disabled}
    {...restProps}
  >
    {@render children?.()}
  </button>
{/if}
src/lib/components/ui/button/index.ts
import Root, {
  type ButtonProps,
  type ButtonSize,
  type ButtonVariant,
  buttonVariants,
} from "./button.svelte";

export {
  type ButtonProps as Props,
  type ButtonProps,
  type ButtonSize,
  type ButtonVariant,
  buttonVariants,
  Root,
  //
  Root as Button,
};
src/lib/components/ui/card/card-action.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
  bind:this={ref}
  data-slot="card-action"
  class={cn(
    "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
    className,
  )}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/card-content.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
  bind:this={ref}
  data-slot="card-content"
  class={cn("flex flex-col gap-3 px-(--card-spacing)", className)}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/card-description.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
</script>

<p
  bind:this={ref}
  data-slot="card-description"
  class={cn("text-muted-foreground text-sm", className)}
  {...restProps}
>
  {@render children?.()}
</p>
src/lib/components/ui/card/card-footer.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
  bind:this={ref}
  data-slot="card-footer"
  class={cn(
    "rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing) flex items-center",
    className,
  )}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/card-header.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
  bind:this={ref}
  data-slot="card-header"
  class={cn(
    "gap-1 rounded-t-xl px-(--card-spacing) [.border-b]:pb-(--card-spacing) group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",
    className,
  )}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/card-title.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
  bind:this={ref}
  data-slot="card-title"
  class={cn(
    "text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",
    className,
  )}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/card.svelte
<script lang="ts">
  import type { HTMLAttributes } from "svelte/elements";
  import { cn, type WithElementRef } from "#lib/utils.js";

  let {
    ref = $bindable(null),
    class: className,
    children,
    size = "default",
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
    size?: "default" | "sm";
  } = $props();
</script>

<div
  bind:this={ref}
  data-slot="card"
  data-size={size}
  class={cn(
    "ring-foreground/10 bg-card text-card-foreground gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",
    className,
  )}
  {...restProps}
>
  {@render children?.()}
</div>
src/lib/components/ui/card/index.ts
import Root from "./card.svelte";
import Action from "./card-action.svelte";
import Content from "./card-content.svelte";
import Description from "./card-description.svelte";
import Footer from "./card-footer.svelte";
import Header from "./card-header.svelte";
import Title from "./card-title.svelte";

export {
  Action,
  Action as CardAction,
  Content,
  Content as CardContent,
  Description,
  Description as CardDescription,
  Footer,
  Footer as CardFooter,
  Header,
  Header as CardHeader,
  Root,
  //
  Root as Card,
  Title,
  Title as CardTitle,
};
src/lib/utils.ts
export { cn } from "cn";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type WithoutChild<T> = T extends { child?: any } ? Omit<T, "child"> : T;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type WithoutChildren<T> = T extends { children?: any }
  ? Omit<T, "children">
  : T;
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
  ref?: U | null;
};

Changes to existing files

src/app.css (changed)
+@import "tailwindcss";+@import "tw-animate-css";+@import "shadcn-svelte/tailwind.css";+@import "@fontsource-variable/inter";−:root {−  font-family: system-ui, sans-serif;−  color: #0f172a;−  background: #f8fafc;−}  +@custom-variant dark (&:is(.dark *));−body {−  margin: 0;−}  +:root {+  --background: oklch(1 0 0);+  --foreground: oklch(0.145 0 0);+  --card: oklch(1 0 0);+  --card-foreground: oklch(0.145 0 0);+  --popover: oklch(1 0 0);+  --popover-foreground: oklch(0.145 0 0);+  --primary: oklch(0.205 0 0);+  --primary-foreground: oklch(0.985 0 0);+  --secondary: oklch(0.97 0 0);+  --secondary-foreground: oklch(0.205 0 0);+  --muted: oklch(0.97 0 0);+  --muted-foreground: oklch(0.556 0 0);+  --accent: oklch(0.97 0 0);+  --accent-foreground: oklch(0.205 0 0);+  --destructive: oklch(0.577 0.245 27.325);+  --border: oklch(0.922 0 0);+  --input: oklch(0.922 0 0);+  --ring: oklch(0.708 0 0);+  --chart-1: oklch(0.87 0 0);+  --chart-2: oklch(0.556 0 0);+  --chart-3: oklch(0.439 0 0);+  --chart-4: oklch(0.371 0 0);+  --chart-5: oklch(0.269 0 0);+  --radius: 0.625rem;+  --sidebar: oklch(0.985 0 0);+  --sidebar-foreground: oklch(0.145 0 0);+  --sidebar-primary: oklch(0.205 0 0);+  --sidebar-primary-foreground: oklch(0.985 0 0);+  --sidebar-accent: oklch(0.97 0 0);+  --sidebar-accent-foreground: oklch(0.205 0 0);+  --sidebar-border: oklch(0.922 0 0);+  --sidebar-ring: oklch(0.708 0 0);−.app {−  min-height: 100vh;−  display: flex;−  flex-direction: column;−  align-items: center;−  justify-content: center;−  gap: 2rem;−  padding: 2rem;−  box-sizing: border-box; }  +.dark {+  --background: oklch(0.145 0 0);+  --foreground: oklch(0.985 0 0);+  --card: oklch(0.205 0 0);+  --card-foreground: oklch(0.985 0 0);+  --popover: oklch(0.205 0 0);+  --popover-foreground: oklch(0.985 0 0);+  --primary: oklch(0.922 0 0);+  --primary-foreground: oklch(0.205 0 0);+  --secondary: oklch(0.269 0 0);+  --secondary-foreground: oklch(0.985 0 0);+  --muted: oklch(0.269 0 0);+  --muted-foreground: oklch(0.708 0 0);+  --accent: oklch(0.269 0 0);+  --accent-foreground: oklch(0.985 0 0);+  --destructive: oklch(0.704 0.191 22.216);+  --border: oklch(1 0 0 / 10%);+  --input: oklch(1 0 0 / 15%);+  --ring: oklch(0.556 0 0);+  --chart-1: oklch(0.87 0 0);+  --chart-2: oklch(0.556 0 0);+  --chart-3: oklch(0.439 0 0);+  --chart-4: oklch(0.371 0 0);+  --chart-5: oklch(0.269 0 0);+  --sidebar: oklch(0.205 0 0);+  --sidebar-foreground: oklch(0.985 0 0);+  --sidebar-primary: oklch(0.488 0.243 264.376);+  --sidebar-primary-foreground: oklch(0.985 0 0);+  --sidebar-accent: oklch(0.269 0 0);+  --sidebar-accent-foreground: oklch(0.985 0 0);+  --sidebar-border: oklch(1 0 0 / 10%);+  --sidebar-ring: oklch(0.556 0 0);−.title {−  font-size: 1.875rem;−  margin: 0; }  +@theme inline {+  --font-sans: "Inter Variable", sans-serif;+  --color-sidebar-ring: var(--sidebar-ring);+  --color-sidebar-border: var(--sidebar-border);+  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);+  --color-sidebar-accent: var(--sidebar-accent);+  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);+  --color-sidebar-primary: var(--sidebar-primary);+  --color-sidebar-foreground: var(--sidebar-foreground);+  --color-sidebar: var(--sidebar);+  --color-chart-5: var(--chart-5);+  --color-chart-4: var(--chart-4);+  --color-chart-3: var(--chart-3);+  --color-chart-2: var(--chart-2);+  --color-chart-1: var(--chart-1);+  --color-ring: var(--ring);+  --color-input: var(--input);+  --color-border: var(--border);+  --color-destructive: var(--destructive);+  --color-accent-foreground: var(--accent-foreground);+  --color-accent: var(--accent);+  --color-muted-foreground: var(--muted-foreground);+  --color-muted: var(--muted);+  --color-secondary-foreground: var(--secondary-foreground);+  --color-secondary: var(--secondary);+  --color-primary-foreground: var(--primary-foreground);+  --color-primary: var(--primary);+  --color-popover-foreground: var(--popover-foreground);+  --color-popover: var(--popover);+  --color-card-foreground: var(--card-foreground);+  --color-card: var(--card);+  --color-foreground: var(--foreground);+  --color-background: var(--background);+  --radius-sm: calc(var(--radius) * 0.6);+  --radius-md: calc(var(--radius) * 0.8);+  --radius-lg: var(--radius);+  --radius-xl: calc(var(--radius) * 1.4);+  --radius-2xl: calc(var(--radius) * 1.8);+  --radius-3xl: calc(var(--radius) * 2.2);+  --radius-4xl: calc(var(--radius) * 2.6);−.nav {−  display: flex;−  gap: 1rem; }  +@layer base {+  * {+    @apply border-border outline-ring/50;+  }+  body {+    @apply bg-background text-foreground;+  }+  html {+    @apply font-sans;+  }−.link {−  color: #475569;−  text-decoration: none;−  font-weight: 500; }  −.link:hover {−  color: #0f172a;−}− −.page {−  display: flex;−  flex-direction: column;−  align-items: center;−  gap: 1.5rem;−}− −.text {−  max-width: 28rem;−  text-align: center;−  color: #475569;−}− −.card {−  background: #fff;−  padding: 2rem;−  border-radius: 1rem;−  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);−  text-align: center;−}− −.count {−  font-size: 3rem;−  font-weight: 700;−  margin: 0;−  font-variant-numeric: tabular-nums;−}− −.row {−  margin-top: 1.5rem;−  display: flex;−  justify-content: center;−  gap: 0.75rem;−}− −.btn {−  background: #0f172a;−  color: #fff;−  border: 0;−  border-radius: 0.5rem;−  padding: 0.5rem 1rem;−  font: inherit;−  cursor: pointer;−}− −.btn:hover {−  background: #334155;−}− 
src/App.svelte (changed)
⋯ 1 unchanged lines   import Counter from "./lib/Counter.svelte"; </script>  +<main+  class="flex min-h-screen flex-col items-center justify-center gap-8 bg-slate-50 p-8 text-slate-900"+>+  <h1 class="text-3xl font-bold tracking-tight">my-app</h1>−<main class="app">−  <h1 class="title">my-app</h1>   <Counter /> </main>  
src/lib/Counter.svelte (changed)
 <script lang="ts">+  import { Button } from "#lib/components/ui/button/index.js";+  import {+    Card,+    CardContent,+    CardFooter,+    CardHeader,+    CardTitle,+  } from "#lib/components/ui/card/index.js";+    let count = $state(0); </script>  +<Card class="w-64 text-center">+  <CardHeader>+    <CardTitle>Counter</CardTitle>+  </CardHeader>+  <CardContent>+    <p class="text-5xl font-bold tabular-nums">{count}</p>+  </CardContent>+  <CardFooter class="justify-center gap-3">+    <Button variant="outline" onclick={() => count--}>-1</Button>+    <Button onclick={() => count++}>+1</Button>+  </CardFooter>+</Card>−<div class="card">−  <p class="count">{count}</p>−  <div class="row">−    <button type="button" class="btn" onclick={() => count--}>-1</button>−    <button type="button" class="btn" onclick={() => count++}>+1</button>−  </div>−</div>  
vite.config.ts (changed)
 import { svelte } from "@sveltejs/vite-plugin-svelte";+import tailwindcss from "@tailwindcss/vite"; import { defineConfig } from "vite";   export default defineConfig({+  plugins: [svelte(), tailwindcss()],−  plugins: [svelte()], });  

Project files

Related templates