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

govuk-table-card

v1.0.0

Published

A responsive table component that uses vertically stacked cards on mobile

Downloads

70

Readme

GOVUK Prototype kit table card plugin

This plugin transforms standard table rows into vertically stacked cards on smaller viewports, ensuring better usability on mobile devices while maintaining full accessibility. The table will function as a typical table when read by a screen reader, preserving the correct semantics.

Features

Installation

To install the plugin, add it to your project using NPM:

npm install govuk-table-card-plugin

Usage

Here’s an example of how to use the govukTableCard component in your project:

{{ govukTableCard({
  caption: {
    text: 'Project deadlines',
    classes: 'govuk-table__caption--l'
  },
  headers: [
    {
      name: 'Deadline'
    },
    {
      name: 'Project name'
    },
    {
      name: 'Days left',
      numeric: true
    }
  ],
  rows: [
    ['10th November 2024', 'Website redesign', '30'],
    ['20th November 2024', 'Marketing campaign', '40'],
    ['5th December 2024', 'New product launch', '55'],
    ['15th December 2024', 'Internal audit', '65'],
    ['1st January 2025', 'Annual report', '82'],
    ['15th January 2025', 'Team onboarding', '96'],
    ['1st February 2025', 'System upgrade', '113'],
    ['15th February 2025', 'Customer feedback review', '127'],
    ['1st March 2025', 'New service rollout', '141'],
    ['15th March 2025', 'Quarterly budget review', '155']
  ]
}) }}

Parameters

  • caption: Defines the table caption. Includes:
    • text: The content of the caption.
    • classes: Optional CSS classes to apply to the caption.
  • headers: An array of objects defining the table headers. Each object can include:
    • name: The header title.
    • numeric: Optional, true for numeric data columns.
  • rows: A 2D array defining the rows of the table, with each inner array representing a single row.

Example output

Example of table responding toe viewport width

Accessibility

The component ensures that all table semantics are preserved for screen readers, meaning that users relying on assistive technologies will have a seamless experience regardless of the viewport size.

Example of voiceover output

Updating

To update, go to http://localhost:3000/manage-prototype/plugins-installed and hit the update button.