Svelte, TypeScript and SSR
The look and feel of the examples are based on Ant Design, but the consumer contracts are defined by @woodger/antd. Start with package types and examples of the corresponding family.
Svelte 5
The example state belongs to the application component: use $state and $derived. Values are passed through props and callbacks; bind is used where it is supported by the component. Snippets are used for custom markup.
| Problem | Approach in Svelte |
|---|---|
| Touch response | onclick |
| Changing the value | bind:value or onValueChange via component API |
| Own markup | Snippet and @render |
| Form State | createForm and explicit connection of the value with the control |
| Reading topic | theme.useToken when initializing a child component |
For Form, FormItem's name alone is not enough: the value and callback are explicitly linked. React hooks and nested components with a dot in their name do not wrap automatically; see exported Svelte component names.
Values, events and initial state
The value and callback define the family. Input uses value/onValueChange, Switch - checked/onCheckedChange, DatePicker - Dayjs | null. multiple Select passes an array; don't replace it with an empty string. onClick/onclick and onChange of different components do not have one universal signature.
bind only works for published bindable props. For createForm, change values via setFieldValue/setFieldsValue rather than bind:value to readonly store. FormItem links signature and validation, but does not clone children or add value itself.
defaultValue and defaultChecked set the initial state. Changing the default prop is not a controlled update. undefined can mean no control, and null can be an explicit empty value; Select the exact value based on the type of specific component.
TypeScript
The package publishes type declarations along with its components. Import types from the same public entry point:
import type { ButtonProps, ThemeConfig } from '@woodger/antd';
const theme: ThemeConfig = { token: { colorPrimary: '#389e0d' } };
const size: ButtonProps['size'] = 'large';
The exact options for values and callbacks depend on the family. Don't disable type checking to copy the prop from the React example; first look for its Svelte analogue in the directory.
Server rendering
Components are used in SSR applications; client actions are connected after mount. Create the form model and initial values for the component or request instance, and not in a general mutable variable of the module.
The server and the first client render should receive the same values. Reading localStorage, window, and DOM sizes are relative to the client lifecycle. For SvelteKit, place the common ConfigProvider in layout; the library does not require disabling SSR for the entire page.
Detailed integration procedure can be found in SvelteKit and SSR.
Snippets and DOM links
For custom markup, pass Snippet and use @render based on the component signature. A Snippet can receive parameters: for example, a FormList row append operation or an iconRender source node. React render function and Svelte snippet are not automatically interchangeable.
nativeElement provides the root where bind:nativeElement is published. Focus/blur and other methods belong to a specific ref, not every HTML root. Get the DOM after mount or from an event handler; before mount and after removal ref may be missing.
API coating
Having a component does not mean having all the features of the React version. The family pages list supported props, semantic slots, design tokens, and restrictions. For example, Select and TreeSelect have separate search, virtualization, and render API boundaries.
Use package imports instead of internal files. For your own control, keep name, focus and keyboard controls accessible; check it along with the form, theme and SSR.