Getting started

Install the package, import the tokens once and use the component.

Installation

Svelte 5 is required as a peer dependency.

npm install svelte-ant-design

Usage

Import the design tokens once, in the entry point of the application. Without them buttons look like plain text: no colours, borders or padding.

<script lang="ts">
  import 'svelte-ant-design/tokens.css';
  import { Button } from 'svelte-ant-design';
</script>

<Button type="primary">Hello</Button>

SvelteKit

In SvelteKit the tokens can be imported in the root layout. Checked manually on a minimal app: the build, server-side rendering and hydration work.

<!-- src/routes/+layout.svelte -->
<script lang="ts">
  import 'svelte-ant-design/tokens.css';
  let { children } = $props();
</script>

{@render children()}

TypeScript

Types are exported together with the components:

import type { ButtonType, ButtonSize } from 'svelte-ant-design';