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

@uswds-wc/feedback

v2.6.0

Published

USWDS Feedback Components - Web Components

Downloads

42

Readme

@uswds-wc/feedback

USWDS Feedback Components - Alerts, banners, modals, and user feedback as Web Components.

Overview

The @uswds-wc/feedback package provides web component versions of USWDS components for displaying feedback, notifications, and important messages to users.

Installation

npm install @uswds-wc/feedback lit

Components

Alert (<usa-alert>)

Contextual feedback messages for user actions.

<usa-alert type="success">
  <h4 slot="heading">Success</h4>
  Your application has been submitted.
</usa-alert>

<usa-alert type="warning">
  <h4 slot="heading">Warning</h4>
  Please review the information below.
</usa-alert>

<usa-alert type="error">
  <h4 slot="heading">Error</h4>
  There was a problem processing your request.
</usa-alert>

<usa-alert type="info">
  <h4 slot="heading">Information</h4>
  Additional details are available.
</usa-alert>

Properties:

  • type: 'success' | 'warning' | 'error' | 'info'
  • slim - Condensed version without icon
  • no-icon - Hide the status icon

Site Alert (<usa-site-alert>)

Site-wide emergency or important announcements.

<usa-site-alert type="emergency">
  <h3 slot="heading">Emergency Alert</h3>
  <p>Short description of emergency alert</p>
</usa-site-alert>

<usa-site-alert type="info">
  <h3 slot="heading">Informational Alert</h3>
  <p>General site announcement</p>
</usa-site-alert>

Properties:

  • type: 'emergency' | 'info'
  • slim - Reduced height version

Banner (<usa-banner>)

Official government website banner.

<usa-banner>
  <!-- Automatically includes "An official website of the United States government" -->
</usa-banner>

Features:

  • Expandable details section
  • Automatic HTTPS and .gov domain guidance
  • Mobile-responsive

Modal (<usa-modal>)

Overlay dialog for focused user interaction.

<usa-modal id="example-modal">
  <h2 slot="heading">Modal Title</h2>
  <p>Modal content goes here.</p>
  <usa-button slot="footer" variant="secondary" data-close-modal>
    Cancel
  </usa-button>
  <usa-button slot="footer">
    Confirm
  </usa-button>
</usa-modal>

<usa-button data-open-modal="example-modal">
  Open Modal
</usa-button>

Properties:

  • open - Control modal visibility
  • size: 'default' | 'large'
  • force-action - Require user interaction (disable close on backdrop click)

Events:

  • modal-open - Fired when modal opens
  • modal-close - Fired when modal closes

Tooltip (<usa-tooltip>)

Contextual information on hover/focus.

<usa-button aria-describedby="tooltip-1">
  Hover me
</usa-button>

<usa-tooltip id="tooltip-1" position="top">
  This is helpful information
</usa-tooltip>

Properties:

  • position: 'top' | 'bottom' | 'left' | 'right'
  • for - ID of element to attach tooltip to

Usage Example

Alert with Dismissal

import '@uswds-wc/feedback';

const alert = document.createElement('usa-alert');
alert.type = 'success';
alert.innerHTML = `
  <h4 slot="heading">Success!</h4>
  Your changes have been saved.
`;

document.body.appendChild(alert);

// Auto-dismiss after 5 seconds
setTimeout(() => {
  alert.remove();
}, 5000);

Modal Dialog

// Open modal
const modal = document.querySelector('#example-modal');
modal.open = true;

// Listen for close event
modal.addEventListener('modal-close', () => {
  console.log('Modal closed');
});

// Programmatic close
modal.open = false;

Tooltip Example

<p>
  This feature is
  <span id="beta-feature">
    beta
    <usa-tooltip for="beta-feature" position="top">
      This feature is in beta testing and may change.
    </usa-tooltip>
  </span>
  and subject to changes.
</p>

Site Alert with Action

<usa-site-alert type="info">
  <h3 slot="heading">New Feature Available</h3>
  <p>We've launched a new dashboard. Check it out!</p>
  <usa-button slot="action" variant="outline">
    Learn More
  </usa-button>
</usa-site-alert>

Bundle Size

Gzipped: ~40 KB

Features

  • User Feedback - Complete suite of feedback components
  • Accessibility - ARIA live regions for screen readers
  • focus Trap** - Modal focus management
  • Keyboard Support - Full keyboard navigation
  • Responsive - Mobile-friendly implementations
  • TypeScript - Full type definitions included

Accessibility Features

  • Alerts - Use ARIA live regions for dynamic announcements
  • Modals - Focus trap, keyboard escape, screen reader announcements
  • Tooltips - Proper ARIA labeling and describedby relationships
  • Banner - Semantic HTML with proper disclosure pattern

Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • ES2020+ required
  • Web Components v1 spec

Dependencies

  • @uswds-wc/core - Core utilities and base components
  • lit ^3.0.0 (peer dependency)

Development

# Build the package
pnpm run build

# Run tests
pnpm test

# Type checking
pnpm run typecheck

# Linting
pnpm run lint

Storybook

View live examples and interactive documentation:

USWDS Web Components Storybook

License

MIT

Repository

USWDS Web Components Monorepo

Related Packages

Contributing

See the main repository for contribution guidelines.