Ant Design Svelte

Movement

Movement helps to notice the result of an action and the connection between interface states. First, determine what you want the user to understand from the transition, then choose its duration and shape.

When transition helps

Useful animations show the origin of a panel, the change of the selected item, or the completion of an action. It must have a clear reason and not delay the work.

Problem What to show Example Component
Changing the selected value Relationship between old and new positions Segmented
Explanation appears Communication with the control element Tooltip
Sequence View Frame transition direction Carousel

If the result is already obvious, the additional effect may be unnecessary. Use loading state to wait for data, and Progress for known progress percentage.

Three principles

Ant Design offers natural, fast and discreet movement. A transition should link states, leave the interface responsive, and occupy only as much attention as the task requires.

Avoid the complex trajectory of the secondary indicator. The contents of the expanded menu are more important than the effect of rotating its arrow. Closing a panel usually requires less attention than introducing new content.

Check the transition with a series of actions: the user can change the selection again while the previous effect is still running. The current value and handlers must match the last action.

Duration and performance

The current topic has motionDurationFast, motionDurationMid, motionDurationSlow and motionEase* curves. Get them from theme.useToken() if the native element needs to match the app's theme.

Transform is suitable for simple movement: it preserves the element’s place in the layout. You can use opacity to appear. Changes to height or width are sometimes necessary, but require separate checking of the content and adjacent blocks. Don't add persistent animation to an element that is simply waiting for user action.

Do not wait to save the value or display the result until the end of the decorative transition. Even with motion disabled, the action should complete and remain accessible from the keyboard.

Motion reduction

In ConfigProvider.theme.token you can set motion:false. Native CSS effects must take this setting into account explicitly; Just having a design token is not enough for third party CSS. In the example, the duration of the own transition becomes zero when motion is turned off.

Additionally consider prefers-reduced-motion:reduce. In the example, the CSS disables movement on the system setting, preserving the final card position and result text. Disabling motion should not hide content or deprive the user of feedback.

Controlled transition

Click Move Card: It moves between the start and end of the track. Pressing again changes direction. The field below the track remains available and saves the entered text.

The “No animation in example” switch changes motion only in the ConfigProvider nested area. The child component reads the tokens of this scope. Both files are included in the card source code so that the entire example can be transferred.

Start of track Duration: 0.2s

Movement by action

The transition reads the nested topic tokens and takes into account the systemic reduction in movement.

Status and Focus

Moving an element does not require re-creating the form or losing focus. The decorative example card is excluded from the accessibility tree, and the position is reported as a separate text result.

For a truly hidden panel, transparency alone is not enough: invisible fields should not accidentally remain accessible via Tab. Hiding behavior, DOM destruction, and focus restoration are selected by the specific component's API. To open a self-contained task, use Modal rather than a self-made transparent layer.

Why motion matters

Motion connects a state change with an action, supports naturalness and makes results noticeable. Evaluate it by what a person understood: where a panel came from, which record changed or whether an operation finished. Repeating decorative motion should not compete with work.

Natural, performant and concise

Natural motion uses understandable direction and acceleration. Performant motion keeps content available without overloading the page. Concise motion shows only a meaningful change. Coordinate durations and curves across related components and check behaviour on an actual device.

When motion is disabled, preserve the action, final position, focus and clear feedback.

Adapted from the guide by Ant Design. MIT.