Skip to main content Red Hat Design System logo Contribute on Github v2.0.0 Home
About About the design systemHow we buildRoadmap
Get started OverviewDesignersDevelopers
Foundations OverviewColorGridPersonalization patternsSpacingTypography
Tokens Overview Global colorBox shadowTypographyBorderOpacitySpaceLengthIconBreakpointsMedia queries
Elements All elements Accordion Alert Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Call to action Card Code block Dialog Footer Health index Icon Navigation (primary)Planned Navigation (secondary) Pagination PopoverPlanned Progress stepsPlanned Site status Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed
Patterns All patternsAnnouncementCardDisclosureFilterFormLinkLink with iconLogo wallSearch barSkip navigationSticky bannerSticky cardTabsTileVideo thumbnail
Accessibility FundamentalsContentDesignDevelopmentContributorsQa and testingAssistive technologiesResources
Design/code status Release notes Get support

Icon

Overview Style Guidelines Code Demos Accessibility
  1. Installation
  2. Usage
  3. rh-icon
  1. Installation
  2. Usage
  3. rh-icon

Installation

Usage

Loading

Icons load lazily by default, meaning that the browser will not attempt to fetch and render the icon until it scrolls into view. You can change this with the loading attribute, which has three values:

  1. lazy (the default): load icons when they scroll into view
  2. idle: load each icon on the page as soon as the browser enters an idle state Or, on less-capable browsers, at the next frame
  3. eager: each icon will begin to load and render the moment it connects to the DOM.

You might choose to enable eager rendering for "above-the-fold" content, but keep lazy loading for the rest of the page.

rh-icon

Slots 1
Slot Name Description

Slotted content is used as a fallback in case the icon doesn't load

Attributes 4
DOM Property Description Type Default
set

Icon set

IconSetName | undefined
unknown
icon

Icon name

IconNameFor<IconSetName> | undefined
unknown
accessibleLabel

Defines a string value that labels the icon element. Adds role="img" to element.

string | undefined
unknown
loading

Controls how eager the element will be to load the icon data

  • eager: eagerly load the icon, blocking the main thread
  • idle: wait for the browser to attain an idle state before loading
  • lazy (default): wait for the element to enter the viewport before loading
'idle' | 'lazy' | 'eager' | undefined
'lazy'
Methods 0

None

Events 3
Event Name Description
load

Fired when an icon is loaded and rendered

set
error

Fired when an icon fails to load

CSS Shadow Parts 1
Part Name Description
fallback

Container for the fallback (i.e. slotted) content

CSS Custom Properties 1
CSS Property Description Default
--rh-icon-size

Override default icon size

Design Tokens 0

None

© 2021-2024 Red Hat, Inc. Deploys by Netlify