Icons are the symbolic representation of an action or information, providing visual context and improving usability. These icons have a 16x16 viewboxes and are used in places where space is limited. Refer to your designer for guidance on when to use Compact Icons.
See the Iconography and SVG guidelines to explore the full icon library.
Props
Accessibility
IconCompacts are a great way to help users who have difficulties with reading, focus attention, and low vision impairments.
ARIA attributes
If the icon appears without text, the IconCompact requires accessibilityLabel
, a text description for screen readers to announce and communicate the represented the icon, as shown in the first example.
Avoid using the generic words like "image" or "icon"; instead, use verbs that describe the meaning of the icon.
If an icon has a visible label that describes what the icon represents, accessibilityLabel
can be an empty string.
Legibility
Ensure that icons use a contrast ratio of 4.5:1 between icon color and background color.
Localization
Be sure to localize all text strings. Note that localization can lengthen text by 20 to 30 percent.
Variants
Colors
IconCompacts can be created using the following color options. brandPrimary
should only be used to represent the Pinterest logo, as it is not accessible. See the
design tokens for more info.
Custom icon
IconCompact accepts both Gestalt icons and custom icons, as shown in the second example. For custom icons, follow the iconography and SVG guidelines.
import { Flex, IconCompact } from 'gestalt'; export default function Example() { return ( <Flex alignItems="center" height="100%" justifyContent="center" width="100%" > <IconCompact accessibilityLabel="Add new Pins" icon="compact-add" /> </Flex> ); }
import { Flex, IconCompact } from 'gestalt'; export default function Example() { return ( <Flex alignItems="center" height="100%" justifyContent="center" width="100%" > <IconCompact accessibilityLabel="Add new Pins" dangerouslySetSvgPath={{ __path: 'M9.41 1.41a1.41 1.41 0 0 0-2.82 0V6.6H1.4a1.41 1.41 0 1 0 0 2.82h5.2v5.18a1.41 1.41 0 1 0 2.82 0V9.4h5.18a1.41 1.41 0 1 0 0-2.82H9.4z', }} /> </Flex> ); }
Writing
Use a descriptive label to describe the IconCompact
- Be succinct. Exclude unnecessary words.
- Be informative and accurate
- Write in the active voice
- Avoid technical jargon
- Use the words "image" or "icon" in the description label; instead, use words that indicate the purpose of the icon.
Component quality checklist
Quality item | Status | Status description |
---|---|---|
Figma Library | Component is not currently available in Figma. | |
Responsive Web | Component does not respond to changing viewport sizes in web and mobile web. |
Related
IconButton
Use IconButton when only an icon is needed to represent an action instead of text.
Button
Use Button to allow users to take an action.