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

@polarityio/pi-radio

v1.0.3

Published

Radio button and radio group components with keyboard navigation

Downloads

507

Readme

Polarity Integration Component Library

Radio Component

Radio button and radio group components for single-option selection with full keyboard navigation and accessibility support.

Installation

npm install @polarityio/pi-radio

Peer Dependencies

Usage

import '@polarityio/pi-radio';
<!-- Basic radio group -->
<pi-radio-group label="Select a color" value="red">
  <pi-radio value="red">Red</pi-radio>
  <pi-radio value="green">Green</pi-radio>
  <pi-radio value="blue">Blue</pi-radio>
</pi-radio-group>

<!-- Horizontal layout -->
<pi-radio-group label="Size" horizontal value="medium">
  <pi-radio value="small">Small</pi-radio>
  <pi-radio value="medium">Medium</pi-radio>
  <pi-radio value="large">Large</pi-radio>
</pi-radio-group>

<!-- With disabled options -->
<pi-radio-group label="Plan" value="free">
  <pi-radio value="free">Free</pi-radio>
  <pi-radio value="pro">Pro</pi-radio>
  <pi-radio value="enterprise" disabled>Enterprise (coming soon)</pi-radio>
</pi-radio-group>

Handling Changes

const group = document.querySelector('pi-radio-group');

group.addEventListener('pi-change', (e) => {
  console.log('Selected value:', e.detail.value);
});

API Reference

<pi-radio> Properties

| Property | Type | Default | Description | | ----------- | --------- | ------- | ---------------------------------------------------- | | checked | boolean | false | Whether the radio button is currently selected | | disabled | boolean | false | Whether the radio button is disabled | | condensed | boolean | false | Applies condensed styling with reduced padding | | name | string | '' | Name attribute for the underlying native radio input | | value | string | '' | The value of the radio button |

<pi-radio> Events

| Event Name | Detail | Description | | ----------------- | ------------------- | --------------------------------------- | | pi-radio-select | { value: string } | Fired when the radio button is selected |

<pi-radio> Slots

| Slot Name | Description | | ----------- | -------------------------- | | (default) | Radio button label content |

<pi-radio> CSS Parts

| Part Name | Description | | --------- | ----------------------------------------------------- | | control | The radio control element (circular button indicator) | | label | The radio label area |

<pi-radio> Public Methods

| Method | Description | | ---------- | ------------------------------------------------------------------------------------------------ | | select() | Selects the radio button if it is not disabled or already checked. Dispatches pi-radio-select. |


<pi-radio-group> Properties

| Property | Type | Default | Description | | ------------ | --------- | ------- | ------------------------------------------------------------------- | | name | string | '' | Applied to all child radio buttons in the group | | value | string | '' | The value of the currently selected radio button | | disabled | boolean | false | Disables all radio buttons in the group | | label | string | '' | Label text displayed above the radio group (also sets aria-label) | | horizontal | boolean | false | Changes layout from vertical column to horizontal row |

<pi-radio-group> Events

| Event Name | Detail | Description | | ----------- | ------------------- | ---------------------------------------------------------------------- | | pi-change | { value: string } | Fired when the selected radio changes via click or keyboard navigation |

<pi-radio-group> Slots

| Slot Name | Description | | ----------- | ------------------------------------ | | (default) | Contains <pi-radio> child elements |

<pi-radio-group> CSS Parts

| Part Name | Description | | --------- | --------------------------------- | | group | The radio group container element |

<pi-radio-group> Keyboard Navigation

| Key | Behavior | | -------------------------- | -------------------------------------------------- | | ArrowDown / ArrowRight | Move to the next enabled radio (wraps to first) | | ArrowUp / ArrowLeft | Move to the previous enabled radio (wraps to last) | | Home | Move to the first enabled radio | | End | Move to the last enabled radio |

CSS Custom Properties

These properties apply to both <pi-radio> and <pi-radio-group>:

| Property | Default | Description | | ------------------------------- | ------------------------------------ | ----------------------- | | --pi-font-family-base | 'NotoSans', sans-serif | Font family | | --pi-size-font-base | 0.8125rem | Base font size | | --pi-color-font-primary | (inherited) | Primary font color | | --pi-color-font-disabled | #8b8e98 | Disabled font color | | --pi-color-background-primary | #1f6dde | Checked radio color | | --pi-color-background-hover | #353b4a | Hover background color | | --pi-size-spacing-xs | 0.25rem | Extra small spacing | | --pi-size-spacing-sm | 0.5rem | Small spacing | | --pi-size-radius-base | 4px | Base border radius | | --pi-transition-fast | 150ms ease-in-out | Transition timing | | --pi-border-width-focus | 2px | Focus ring border width | | --pi-color-border-focus | var(--pi-color-background-primary) | Focus ring color |

Theming

Customize the appearance using CSS custom properties. This component uses design tokens from @polarityio/pi-shared for consistent theming across the component library.

pi-radio::part(control) {
  width: 20px;
  height: 20px;
}

pi-radio-group::part(group) {
  gap: 12px;
}

License

MIT