Vistaprint
styleKeyscontrolIcon

Control Icon

The Control Icon is a utility component that lets you create an arbitrary icon from our stock icon set. The typical use case is inside a button or link, so that a click on the icon performs a related action.

Playground

Share
Share
jsx
jsx
<ControlIcon iconType="arrow-r" />
<span class="control-icon control-icon-arrow-r"></span>
<!-- doesn't have to be a <div> tag -->

Skin

Brand Blue

Share
Share
jsx

White

Share
Share
jsx

Semantics

By default, a Control Icon has no special semantics. It is typically used with a <span> tag, and that is what the React Visage component will use as its default tag.

If your Control Icon is clickable, you need to apply the proper HTML semantics:

  • If clicking the icon performs a navigation, use the <a> tag. In React Visage, set the component prop to have a value of "a". You can also place the Control Icon inside of a link instead.

  • If clicking the icon performs an in-page action, use a <button> tag instead, or place the Control Icon inside a with the "Unstyled" skin.

Hover Container

By Default, a Control Icon can change its color when it is directly hovered over. However, if you want the icon to change color when an ancestor is hovered over, place the a Control Icon Hover Container on that ancestor.

Notice in the following example how the ControlIcon changes color when you hover anywhere inside of the ControlIconHoverContainer.

Undo
Share
Share
jsx
jsx
<ControlIconHoverContainer>
other content
<ControlIcon iconType="undo" skin="brand-blue" />
</ControlIconHoverContainer>
<span class="control-icon-hover-container">
other content
<span class="control-icon control-icon-undo control-icon-brand-blue"></span>
</span>

Components

ControlIcon

PropTypeDefaultDescription
iconType"menu" | "search" | "download" | "error" | "arrow-r" | "arrow-l" | "arrow-u" | "arrow-d" | "check" | "close" | "close-large" | "close-small" | "info" | "minus" | "password-show" | "password-hide" | "plus" | "redo" | "save" | "search-large" | "undo" | "zoom-in" | "zoom-out"required

The type of icon to show

skin"white" | "standard" | "brand-blue""standard"

The visual style of the Control Icon

All other props are forwarded to the element specified in thecomponentprop(default: <span/>)

ControlIconHoverContainer

ControlIconHoverContainer has no props of its own

All props are forwarded to the element specified in thecomponentprop(default: <span/>)

Guidelines

Do

  • Use to enable user action when space is limited.

Don't

  • Alter or manipulate the existing icons.

  • Change or add colors to the existing icons.

Accessibility Guidelines

  • Control icons need to use the correct HTML tag and/or ARIA attributes, depending on their function:

    • If the control icon is just for display and is not independently clickable (e.g. it just shows an "info" icon, or a ">" icon at the end of a hyperlink), it should just use a span tag.

    • If the control icon is clickable by itself, and acts functionally as a button (i.e. it can be clicked to perform an action on the page), it should be a span tag inside a button tag.

    • If the control icon is clickable by itself, and acts as a hyperlink (i.e. clicking on it takes the user to a new page), it should be a span tag inside an a tag.

  • Then, it also needs to either have its role made obvious for assistive technologies, or it needs to be hidden from them:

    • If the icon is purely decorative (e.g. the ">" at the end of a text link or button), it should have the attribute aria-hidden="true" to hide it from assistive technologies.

    • If the icon is clickable by itself, but has nearby text that explains what it does, it should have an aria-labelledby attribute whose value is the id of the element that describes it.

    • If the icon is clickable and sits on its own, but does not have nearby text that explains what it does (e.g. an "x" button that closes a panel), the button should have an inner span that is visually hidden. Inside this span, add localized text explaining what the button does (e.g. "Close", "Next").