<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Icons

Icons guide

Icons are available in several formats and are suitable for different types of projects and platforms. You will need to include the icon stylesheet.

For the React API, use Icon with iconType

The preview has been updated.

For the Vanilla API, use img with the icon URL.

Share

Size

Use size to specify a size for icons. The standard size for icons is standard, which aligns with the body-standard font skin. The standard icon size is responsive and compact mode compatible. Icons can also be set to the static sizes 16p, 20p, and 24p.

The preview has been updated.

Skin

Standard

Use standard by default. This skin changes icons to white in darkMode.

The preview has been updated.

Success

Use success for Icons that signify a positive or successful status.

The preview has been updated.

Warning

Use warning for Icons that signify a caution status.

The preview has been updated.

Error

Use error for Icons that signify an error status.

The preview has been updated.

Accent

Use accent for Icons that signify a standout area or a brand moment.

The preview has been updated.

White

Use white for Icons placed on a dark background to increase their visibility. Note: The preferred way to display a white icon is to place an icon with the standard skin within a dark mode container.

The preview has been updated.

Custom icons

Use Icon to create a custom icon that can follow SWAN's standard size variations. Pass the image URL into src.

The preview has been updated.

objectFit

Use objectFit to control the resizing behavior of the image and how it fits into its parent element. Refer to CSS object-fit property.

The preview has been updated.

Accessibility

When used inside a Button without text you must include an accessible label via one of the methods listed below.

  • Use alt with a descriptive value on the Icon.
  • Use aria-label with a descriptive value on the Button.
  • Use aria-labelledby if the Button has nearby descriptive text. Set the value of the attribute to the ID of the element containing the description text.
  • Use a visually hidden inner span with descriptive text.

If the icon is purely decorative, use aria-hidden="true" to hide it from assistive technologies

This text must be localized.

Props

Icon
This component is implemented using the <img /> as the root element. You can utilize the native attributes supported by <img /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
size"standard" | "10p" | "28p" | "32p" | "40p" | "48p" | "60p" | "16p" | "20p" | "24p" | nullfalse
The size of the icon. One of: "standard", "10p", "16p", "20p", "24p", "28p", "32p", "40p", "48p", "60p" Size "10p" is deprecated. Use "16p" size instead. Size "28p", "32p", "40p", "48p" and "60p" are deprecated. Use "standard" size instead.
null
skin"standard" | "accent" | "success" | "warning" | "error" | "white" | nullfalse
The visual style of the icon. One of: "white", "standard", "error", "warning", "success". 'white' option is deprecated - use 'standard' instead in dark mode
standard
iconType"standard" | "menu" | "search" | "filter" | "image" | "text" | "view" | "list" | "fill" | "rotate" | "download" | "vertical" | "email" | "info" | "success" | "warning" | "error" | ... 136 more ...false
The type of icon to show.
null
objectFit"none" | "fill" | "unset" | "contain" | "cover" | nullfalse
Sets the resizing behaviour of the image. One of: "cover", "contain", "none", "unset", "fill"
null