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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@metrostar/comet-uswds

v3.6.2

Published

React with TypeScript Component Library based on USWDS 3.0.

Downloads

3,965

Readme

Comet

Comet is a React with TypeScript Component Library based on USWDS 3.0.

In order to utilize Comet within your app, you must first ensure USWDS is pre-configured in your app. Please review the following for details specific to USWDS prior proceeding: USWDS Documentation.

Getting Started with the Comet Starter App (recommended)

  1. Clone the comet starter repo here: Comet Starter

  2. Follow the steps for "Running the Project Locally"

Getting Started with a Custom App (pre-configured for USWDS)

  1. Add Comet to your project:
# npm
npm i --save @metrostar/comet-uswds
# or yarn
yarn add @metrostar/comet-uswds
  1. Add your first Comet component:
import { Alert } from '@metrostar/comet-uswds';

<Alert id="alert-1" type="info">
  This is the alert body
</Alert>;

Getting Started with a Custom App (NOT pre-configured for USWDS)

Note: the below setup assumes your project is setup for Vite and SCSS.

  1. Add USWDS and Comet to your project:
# npm
npm i --save @uswds/uswds @metrostar/comet-uswds

# or yarn
yarn add @uswds/uswds @metrostar/comet-uswds
  1. Add uswds directory to your src folder
  2. Add base USWDS file (uswds.scss) to the uswds directory, with the following:
// Include a USWDS settings file (required)
@forward './uswds-settings.scss';

// Point to the USWDS source code (required)
@forward '~uswds/packages/uswds';

// Include your project's custom Sass (optional)
// @forward "project-custom.scss";
  1. Add base USWDS settings file (uswds-settings.scss) to the uswds directory, with the following:
@use 'uswds-core' with (
  // General settings
  $theme-show-notifications: false,
  $theme-font-path: '~uswds/dist/fonts',
  $theme-image-path: '~uswds/dist/img'
);
  1. Add uswds to the top of your your SASS entry point (styles.scss), with the following:
@forward 'uswds/uswds.scss';
  1. Update your Vite config file (vite.config.ts) as needed with the following USWDS specific configurations:
import react from '@vitejs/plugin-react';
import autoprefixer from 'autoprefixer';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineConfig } from 'vite';
import EnvironmentPlugin from 'vite-plugin-environment';
import eslint from 'vite-plugin-eslint';
import tsconfigPaths from 'vite-tsconfig-paths';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), tsconfigPaths(), eslint(), EnvironmentPlugin('all')],
  resolve: {
    alias: {
      '~uswds': path.resolve(__dirname, 'node_modules/@uswds/uswds'),
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        includePaths: ['node_modules/@uswds/uswds/packages'],
      },
    },
    postcss: {
      plugins: [autoprefixer],
    },
  },
});
  1. Add your first Comet component:
import { Alert } from '@metrostar/comet-uswds';

<Alert id="alert-1" type="info">
  This is the alert body
</Alert>;

For any further troubleshooting, please refer to the comet starter app linked above.