Skip to main content Home About the Design SystemRoadmap OverviewDesignersDevelopers OverviewColorGridIconographyInteractionsSpacingTypography Overview Global colorBox shadowTypographyBorderOpacitySpaceLengthIconBreakpointsMedia queries All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button group Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Menu dropdown Navigation link Navigation (primary) Navigation (secondary) Navigation (vertical) Pagination PopoverPlanned Progress stepper Readtime Scheme toggle Site status Skeleton Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed OverviewColor PalettesCustomizingDevelopers All PatternsAccordionCall to ActionCardFilterFormLink with iconLogo wallSearch barSticky bannerSticky cardTabsTagTile All Personalization PatternsAnnouncement FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers Design/code status Release notes Get support

Readtime

OverviewCodeDemos
ImportingUsagerh-readtimeImportingUsagerh-readtime

Importing

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

<script type="module">
  import '@rhds/elements/rh-readtime/rh-readtime.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.

Usage

<meta itemprop="description" content="Uses a CSS selector to target a content container. The component counts words and images from the target element to compute reading time.">

<rh-readtime images selector="#article-content">%t min read</rh-readtime>

<article id="article-content">
  <p>
    Design systems are a collection of reusable components, guided by clear standards,
    that can be assembled together to build any number of applications. They help teams
    build better products faster by making design reusable and development more consistent.
    A design system is more than a pattern library or a set of guidelines. It is a living,
    evolving ecosystem that supports both designers and developers in creating cohesive
    user experiences across products and platforms.
  </p>
  <p>
    The Red Hat Design System provides a set of web components built on open web standards.
    These components follow Red Hat brand guidelines and are designed to work across any
    web framework. They are built with accessibility in mind and support theming through
    design tokens. The system includes components for layout, navigation, content display,
    forms, and feedback. Each component is documented with usage guidelines, code examples,
    and accessibility considerations.
  </p>
  <p>
    Web components offer several advantages over traditional framework-specific components.
    They work natively in the browser without requiring a build step or framework dependency.
    They encapsulate styles and behavior using the Shadow DOM, preventing conflicts with
    the rest of the page. They can be used with any JavaScript framework or with no framework
    at all. This makes them ideal for design systems that need to support multiple teams
    using different technology stacks.
  </p>
  <img src="placeholder-600x300.svg" alt="Placeholder image" width="600" height="300">
  <p>
    Reading time estimation is a useful feature for content-heavy pages. It gives readers
    an expectation of how long an article will take to read, helping them decide whether
    to read now or save for later. Medium popularized this feature, and it has since become
    a common pattern on blogs and documentation sites. The algorithm accounts for both
    text content and images, since images require additional time to process and understand.
  </p>
</article>

<style>
article p {
  font-size: var(--rh-font-size-body-text-md, 1rem);
  line-height: var(--rh-line-height-body-text, 1.5);
  margin-block-end: 1rem;
}
</style>


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

rh-readtime

Provides an estimated reading time for content. Authors SHOULD provide a selector or nest inside a container. Authors MUST use %t in light DOM as a minutes placeholder. AVOID combining word-count with selector. Renders as inline text readable by screen readers without additional ARIA roles. No keyboard interaction is needed as this element is non-interactive display text.

Slots 0

None

Attributes 4

Attribute DOM Property Description Type Default
selector selector

CSS selector targeting the content container to read from. If omitted and word-count is not set, defaults to parentElement.

string
unknown
word-count wordCount

Manual word count. When set, the component uses this value directly instead of reading from a container.

number
unknown
image-count imageCount

Manual image count. Enables image time weighting in either mode. In container mode, overrides the DOM image count.

number
unknown
images images

Opt-in to image weighting in container mode. When set, counts <img> and non-decorative <svg> elements from the target container. Not needed when image-count is set. In property mode without image-count, has no effect.

boolean
false

Methods 0

None

Events 0

None

CSS Shadow Parts 0

None

CSS Custom Properties 0

None

Design Tokens 4

Token Description Copy
--rh-font-family-body-text

Sets the body text font family using the --rh-font-family-body-text design token

Body text font family

Full CSS Variable Permalink to this token
--rh-font-size-body-text-md

Sets the body text size using the --rh-font-size-body-text-md design token

16px font size

Full CSS Variable Permalink to this token
--rh-font-weight-body-text-regular

Sets the body text weight using the --rh-font-weight-body-text-regular design token

Regular font weight

Full CSS Variable Permalink to this token
--rh-line-height-body-text

Sets the body text line height using the --rh-line-height-body-text design token

Line height for body text

Full CSS Variable Permalink to this token

Other libraries

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

© 2026 Red Hat Deploys by Netlify