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

@papit/radio

v0.0.1

Published

a simple radio that is complient with wcag

Readme

@papit/radio

A WAI-ARIA compliant radio button web component, built on @papit/web-component.

Logo


Type Tests NPM version


Installation

npm install @papit/radio

HTML (ESM)

<script type="module" defer>
  import "@papit/radio";
</script>

<pap-radio name="plan" value="free">Free</pap-radio>
<pap-radio name="plan" value="pro" defaultchecked>Pro</pap-radio>

JavaScript / TypeScript

import "@papit/radio";
// or, to use the class directly:
import { Radio } from "@papit/radio";

Usage

Standalone

<pap-radio name="plan" value="free">Free</pap-radio>
<pap-radio name="plan" value="pro">Pro</pap-radio>
<pap-radio name="plan" value="enterprise">Enterprise</pap-radio>

Radios sharing the same name form a group — only one can be checked at a time. Arrow-key navigation moves between them automatically.

With pap-group

Wrap in pap-group to control layout and orientation semantics:

<pap-group aria-label="Subscription plan" aria-orientation="vertical">
  <pap-radio name="plan" value="free">Free</pap-radio>
  <pap-radio name="plan" value="pro" defaultchecked>Pro</pap-radio>
  <pap-radio name="plan" value="enterprise">Enterprise</pap-radio>
</pap-group>

Inside a form

<form>
  <pap-group aria-label="Notify me">
    <pap-radio name="notify" value="always" defaultchecked>Always</pap-radio>
    <pap-radio name="notify" value="never">Never</pap-radio>
  </pap-group>
  <button type="submit">Save</button>
  <button type="reset">Reset</button>
</form>

pap-radio is form-associated. The value attribute is submitted with the form when the radio is checked; on reset, each radio returns to its defaultchecked state (or unchecked if defaultchecked is absent).

Disabled & readonly

<!-- Cannot be interacted with at all -->
<pap-radio name="x" value="a" disabled>Disabled</pap-radio>

<!-- Focusable, readable by screen readers, but state cannot change -->
<pap-radio name="x" value="b" readonly>Read-only</pap-radio>

Attributes

| Attribute | Type | Default | Description | | ---------------- | --------- | ------- | ------------------------------------------------------------- | | name | string | — | Groups radios; enables mutual exclusion and arrow-key nav | | value | string | — | Form value submitted when this radio is checked | | checked | boolean | false | Whether this radio is currently selected | | defaultchecked | boolean | — | Checked state restored on form reset; also sets initial state | | disabled | boolean | — | Disables all interaction | | readonly | boolean | — | Prevents state changes; focus is still possible |


CSS Custom Properties

| Property | Default | Description | | --------------- | -------------- | -------------------------------------------- | | --space-1 | 0.25rem | Gap between marker and label; outline offset | | --space-5 | 1.25rem | Marker width and height | | --info | — | Inner dot fill colour when checked | | --accentColor | currentColor | Accent colour (used via --accent) |

Parts

| Part | Description | | -------- | ---------------------- | | marker | The circular indicator |

/* Example: custom checked colour */
pap-radio::part(marker) {
  border-color: royalblue;
}

pap-radio {
  --info: royalblue;
}

Events

| Event | Bubbles | Description | | -------- | ------- | ---------------------------- | | change | No | Fired when checked changes |


Keyboard Interaction

Follows the WAI-ARIA Radio Group Pattern.

| Key | Behaviour | | -------------------------- | ---------------------------------------------------------------------- | | Tab / Shift+Tab | Moves focus into / out of the group (one tab stop via roving tabindex) | | Space | Checks the focused radio if unchecked | | Enter | Same as Space | | ArrowRight / ArrowDown | Moves focus to the next radio, checks it, wraps around | | ArrowLeft / ArrowUp | Moves focus to the previous radio, checks it, wraps around |

A radio button cannot be unchecked by user interaction. Only selecting a different button in the group will uncheck the current one.


ARIA

| Attribute / Role | Value | | ---------------- | ----------------------------------------------------------------------------------- | | role | radio | | aria-checked | "true" / "false" (reflects checked) | | tabindex | Managed via roving tabindex — "0" for the active/first radio, "-1" for the rest |

The group label should be provided by the parent container (e.g. pap-group with aria-label or aria-labelledby).


Contributing

Contributions are welcome! Please follow the development guidelines and ensure all tests pass before submitting a pull request.

License

Licensed under the @Papit License 1.0 — Copyright © 2024 Henry Pap (@onkelhoy)

Key points:

  • ✅ Free to use in commercial projects
  • ✅ Free to modify and distribute
  • ✅ Attribution required
  • ❌ Cannot resell the component itself as a standalone product

See the LICENSE file for full details.

Related

Support

For issues, questions, or contributions, please visit the GitHub repository.