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

@kit-ng-ui/switch

v0.1.0

Published

Kit UI Switch — toggle control with loading + sizes.

Readme

@kit-ng-ui/switch

The Switch component for Kit UI — a binary on/off toggle.

Install

pnpm add @kit-ng-ui/switch @kit-ng-ui/core @kit-ng-ui/icons

Styles

@use '@kit-ng-ui/core/styles' as *;
@use '@kit-ng-ui/switch/styles' as switch;

Use

import { Component, signal } from '@angular/core';
import { KitSwitchComponent } from '@kit-ng-ui/switch';

@Component({
  standalone: true,
  imports: [KitSwitchComponent],
  template: `
    <kit-switch [(checked)]="enabled" />
    <kit-switch size="sm" />
    <kit-switch checkedLabel="ON" uncheckedLabel="OFF" />
    <kit-switch checkedIcon="check" uncheckedIcon="close" />
    <kit-switch [loading]="saving()" />
    <kit-switch disabled />
  `,
})
export class SwitchDemo {
  enabled = signal(false);
  saving = signal(false);
}

API

| Input | Type | Default | | ---------------- | --------------------- | ----------- | | checked | boolean | false | | disabled | boolean | false | | loading | boolean | false | | size | 'sm' \| 'md' | 'md' | | checkedLabel | string \| null | null | | uncheckedLabel | string \| null | null | | checkedIcon | string \| null | null | | uncheckedIcon | string \| null | null |

Outputs: (checkedChange), (change).

Implements ControlValueAccessor — works with ngModel and reactive forms.

Behavior notes

  • Renders as <button role="switch"> and exposes aria-checked. Space and Enter toggle.
  • [loading] adds a spinner inside the handle and prevents interaction (clicks and keyboard ignored).
  • The "inner" label/icon flips position with the handle: shown on the trailing side when off, on the leading side when on.

Performance notes

  • The handle moves between checked and unchecked positions by animating the CSS left property rather than transform: translateX(...). transform would be cheaper per-frame (composited only) but the switch can grow past its --kit-switch-w track width when the checked/unchecked content is wider than the minimum, and transform with a fixed offset would leave the knob short of the right edge in that case. The transition runs only on a discrete two-state change, so the layout/paint cost is paid once per toggle. If you render large grids of switches that all animate simultaneously, expect a more noticeable frame budget than a pure composite-only transition.