npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spectrum-web-components/contextual-help

v1.12.1

Published

Web component implementation of a Spectrum design ContextualHelp

Readme

Overview

An <sp-contextual-help> shows a user extra information about the state of either an adjacent component or an entire view. It explains a high-level topic about an experience and can point users to more information elsewhere.

View the design documentation for this component.

Usage

See it on NPM! How big is this package in your project? Try it on Stackblitz

yarn add @spectrum-web-components/contextual-help

Import the side effectful registration of <sp-contextual-help> via:

import '@spectrum-web-components/contextual-help/sp-contextual-help.js';

When looking to leverage the ContextualHelp base class as a type and/or for extension purposes, do so via:

import { ContextualHelp } from '@spectrum-web-components/contextual-help';

Anatomy

Contextual help is a wrapper that attaches a popover to an icon-only action button.

It consists of the following parts:

  • Heading: assign the appropriate heading level to the heading slot to provide a title for the popover.
  • Content: text can be displayed within the popover by using the default slot.
  • Link: an optional <sp-link> can be assigned to the link slot per standalone link guidance.

Options

Variants

The default variant is for in-line information using the "info" icon. Use the info icon for informative content: specific, brief, and contextual guidance. This is best for supplemental or nice-to-know information, in-line with a label or a component (if there is no label). The content should be instructive in tone.

<sp-contextual-help>
  <h2 slot="heading">Permission required</h2>
  Your admin must grant you permission before you can create a segment.
  <sp-link
    slot="link"
    href="https://opensource.adobe.com/spectrum-web-components/"
  >
    Request permission
  </sp-link>
</sp-contextual-help>

Use variant="help" for helpful content: more detailed, in-depth guidance about a task, UI element, tool, or keyboard shortcuts. This may include an image, video, or link and should be helpful in tone.

<sp-contextual-help variant="help">
  <h2 slot="heading">What is a segment?</h2>
  Segments identify who your visitors are, what devices and services they use,
  where they navigate from, and much more.
  <sp-link
    slot="link"
    href="https://opensource.adobe.com/spectrum-web-components/"
  >
    Learn more about segments
  </sp-link>
</sp-contextual-help>

Placement

By default an <sp-contextual-help> will render its popover at the bottom-start position. This can be customized using the placement attribute and supports all the placement options an overlay-trigger component supports.

<sp-contextual-help placement="top-start">
  <h2 slot="heading">Permission required</h2>
  Your admin must grant you permission before you can create a segment.
  <sp-link
    slot="link"
    href="https://opensource.adobe.com/spectrum-web-components/"
  >
    Request permission
  </sp-link>
</sp-contextual-help>

Custom max width

Contextual help allows for a custom maximum width to be set using the --mod-spectrum-contextual-help-popover-maximum-width custom property.

Note: Maximum width should not be less than 100px.

<sp-contextual-help
  style="--mod-spectrum-contextual-help-popover-maximum-width: 200px;"
>
  <h2 slot="heading">Custom max width</h2>
  This is a test of the contextual help component with a custom max width of
  200px.
</sp-contextual-help>

Behaviors

<sp-contextual-help> does not fire any events of its own. You can listen, however, for the sp-open and sp-closed events which are fired when the popover opens or closes.

Accessibility

Given that the trigger is an icon-only <sp-action-button>, it is important to provide an accessible name for it, so that it can be properly announced by screen readers. By default, the <sp-contextual-help> uses an aria-label property with either "Information" or "Help" as values, depending on the component's variant. You can customize this using the label attribute.

When providing headings using the heading slot, make sure to provide actual heading elements such as h1, h2, h3 ... or use the role="heading" attribute.