Skip to main content Home
About About the Design SystemRoadmap
Get started OverviewDesignersDevelopers
Foundations OverviewColorGridIconographySpacingTypography
Tokens Overview Global colorbox shadowTypographyborderopacityspacelengthIconBreakpointsMedia Queries
Elements All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Navigation (primary) Navigation (secondary) Pagination PopoverPlanned Progress stepsPlanned Site status Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed
Theming OverviewColor PalettesCustomizingDevelopers
Patterns All PatternsCardTabsFilterFormLinkLink with iconLogo wallSearch barSkip navigationSticky bannerSticky cardTileVideo thumbnail
Personalization All Personalization PatternsAnnouncement
Accessibility FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers
Design/code status Release notes Get support

Announcement

OverviewStyleGuidelinesCodeAccessibilityDemos
ImportingUsagerh-announcementImportingUsagerh-announcement

Importing

Add rh-announcement to your page with this import statement:

<script type="module">
  import '@rhds/elements/rh-announcement/rh-announcement.js';
</script>
Copy to Clipboard Wrap lines

To learn more about installing RHDS elements on your site using an import map read our getting started docs.

Lightdom CSS shim

Warning

Lightdom CSS shims are an optional, temporary solution for reducing CLS. Learn more about lightdom CSS shims .

<link rel="stylesheet" href="/path/to/rh-announcement/rh-announcement-lightdom-shim.css">

Note

Replace /path/to/ with path to the CSS file, whether local or CDN.

Usage

<rh-announcement>
    <svg slot="image" width="80" height="48" role="img" aria-label="Sample image">
      <rect fill="light-dark(var(--rh-color-surface-dark, #383838), var(--rh-color-surface-light, #e0e0e0))" stroke="var(--rh-color-border-subtle)" stroke-width="2px" width="100%" height="100%" stroke-dasharray="4 4">
      </rect>
      <text x="17" y="30" style="font-family: var(--rh-font-family-code, RedHatMono, 'Red Hat Mono', 'Courier New', Courier, monospace); font-size: var(--rh-font-size-body-text-md, 1rem);" fill="light-dark(var(--rh-color-text-primary-on-dark, #ffffff), var(--rh-color-text-primary-on-light, #151515))">
              Image
      </text>
    </svg>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit adipisicing elit adipisicing elit.</p>
  <rh-cta slot="cta" href="#">Learn More</rh-cta>
</rh-announcement>

<link rel="stylesheet" href="../rh-announcement-lightdom-shim.css">

<script type="module">
  import '@rhds/elements/rh-cta/rh-cta.js';
  import '@rhds/elements/rh-announcement/rh-announcement.js';
</script>
Copy to Clipboard Wrap lines

rh-announcement

Announcements are flexible surfaces used to group information in a full width banner layout, traditionally across the top of a page. They are used to announce new features, promos, or news.

Slots 3
Slot Name Description
image

If this slot is used, we expect an image tag with a width and height set. An icon, svg, or use of the icon component are also valid in this region.

Any

content that is not designated for the header or footer slot, will go to this slot.

cta

If this slot is used, we expect a rh-cta component.

Attributes 3
Attribute DOM Property Description Type Default
color-palette colorPalette

Sets color context for child components, overrides parent context

ColorPalette | undefined
unknown
dismissable dismissable

Make an announcement dismissable

boolean
false
image-position imagePosition

Set the position of the image in the announcement on mobile viewports. Possible values are:

  • inline-start
  • block-start
'inline-start' | 'block-start' | undefined
unknown
Methods 0
None
Events 1
Event Name Description
close

When a user clicks the close/dismiss button on an announcement.

CSS Shadow Parts 2
Part Name Description
row

The row for the banner. Contains the image and content divs.

image

The image for the banner. Contains the image slot.

CSS Custom Properties 0
None
Design Tokens 10
Token Copy
--rh-color-surface
Full CSS Variable Permalink to this token
--rh-color-text-primary
Full CSS Variable Permalink to this token
--rh-font-family-body-text
Full CSS Variable Permalink to this token
--rh-font-size-body-text-lg
Full CSS Variable Permalink to this token
--rh-font-size-body-text-md
Full CSS Variable Permalink to this token
--rh-length-lg
Full CSS Variable Permalink to this token
--rh-line-height-body-text
Full CSS Variable Permalink to this token
--rh-space-2xl
Full CSS Variable Permalink to this token
--rh-space-lg
Full CSS Variable Permalink to this token
--rh-space-md
Full CSS Variable Permalink to this token

Other libraries

To learn more about our other libraries, visit the getting started page.

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