Ant Design Svelte

Icons

The icon helps to recognize the action or state before the user reads the signature. Choose familiar looks and keep the icon meaning the same across all parts of the app.

Meaning and purpose of

System icons indicate operations, object types, and states. Section illustrations and branding serve a different purpose: they can be larger and more detailed, but they shouldn't look like an accessible button with no action.

Problem How to show Component
Main action Icon together with verb Button
Short action in panel Button with icon and accessible name Button, Tooltip
Result of the operation Result icon, color and text Alert, Result
Object state Brief caption next to the object Badge, Tag

It is better to sign an important or unfamiliar action. Don't rely on the image to explain the specific operation of the product.

Single form

For adjacent icons, line thickness, rounding, detailing and perspective are coordinated. The same square SVG does not guarantee the same visual weight: a circle, a wide arrow and a narrow sign may require optical adjustment.

Check the result in the size in which the user will see it. Small details visible in the editor may blur on the screen. Don't mix random outline and volumetric images in the same action panel.

Size and color

For an icon inside text or a button, it is convenient to use width and height of 1em. The viewBox specifies the internal coordinate system of the SVG, and the actual size is determined by the CSS. The example uses viewBox 0 0 24 24; this is the geometry of the demo design, not a requirement for each icon.

CurrentColor allows you to inherit text color, including disabled and theme changing. The status color is accompanied by the words: “Ready”, “Error”, “Requires verification”. The main roles of color are described in color guide.

The size of the picture and the pressing area are adjusted separately. A small icon doesn't require a small button. To place next to text, use the icon and iconPlacement of the Button component: it will negotiate the spacing and alignment itself.

Available name

SVG inside a labeled button is hidden from assistive technologies via aria-hidden and excluded from focus. The action name already specifies the text of the button. For a button without text, set aria-label on the button itself; Tooltip assists the sighted user, but does not replace this name.

Keyboard focus should be on the action, not the decorative design within it. If the image itself conveys important information, add visible text or a separate accessible description.

Icon in Svelte

@woodger/antd does not yet have a public Icon component and its own public icon directory. SVG can be passed Svelte snippet to the published icon API of a specific component. The example uses the same method of drawing the search icon as the Button cards on this site.

Switch the icon size and location, then search with a regular button and a button without text. Both trigger the same action. Open the card source code: SVG, captions and handlers are in one file.

Searches completed: 0

Icon and label

SVG snippet inherits the size and color of the button; the available name belongs to the action.

Check in interface

  • The meaning of the icon coincides with the signature and behavior of the action.
  • Light, dark and compact themes maintain readability and alignment.
  • The button is accessible via Tab and is activated from the keyboard.
  • When the text is enlarged, the drawing is not cut off and does not displace the signature.
  • The status can be understood from the text even if the color or icon is not distinguishable.

Grid and optical boundaries

The original Ant Design icon system uses a 1024×1024 grid with key contours for squares, circles and rectangles. These are drawing coordinates; display size is defined separately. Key contours balance the visual weight of different shapes while retaining their character.

Stroke, corners and perspective

Keep stroke weight and corner treatment consistent. A simple flat shape generally reads better than many small details. Optical adjustments in crowded areas are appropriate when they improve recognition at the actual display size.

Names and scaling

Consistent names help locate variants and distinguish outlined, filled and two-tone artwork. Display size follows text and action role. Use current SVG sources and the published snippet API when implementing icons in Svelte.

Adapted from the guide by Ant Design. MIT.