Ant Design Svelte

Getting started

Add @woodger/antd to a Svelte 5 and TypeScript application.

Installing the package

Run this command from your application directory.

npm install @woodger/antd

Import version from @woodger/antd to read the installed version. Use GetProps, GetProp, and GetRef for component props, an individual prop, and a component ref.

npm updates package.json and package-lock.json. If your application imports Day.js, add dayjs as a direct dependency.

Application selection

Application Next step
Svelte without server routes Svelte and Vite
Routes, data loading and SSR SvelteKit
Already existing project Save its configuration, include the package and test the build

Styles and ConfigProvider

ConfigProvider includes styles and passes theme, size and locale to child components. locale translates the library signatures, but not the text of the application itself. Usually one provider is placed in the root component of the application or layout.

If components are used without a ConfigProvider, import the styles once at the application entry point:

import '@woodger/antd/styles.css';

Import components from @woodger/antd, not from internal src or dist paths. The internal files device is not a consumer API.

First example

Enter a name and click the button. The example uses $state, bind:value and a regular onclick. Open the card source code and transfer it to App.svelte or application page.

First example

Input stores the value via bind:value; Button updates the result of the action.

Checking connection

Check the first example: the field accepts input, the button updates the result, and if the name is empty, a tooltip is displayed. Then run type check scripts and build your application. The command names belong to its package.json.

With SSR, additionally check the direct request without JavaScript and the subsequent connection of handlers. Changing the theme and size should not reset the entered text. Analysis of connection errors is in FAQ.

Next steps