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

@pxlkit/ui-kit-core

v2.2.0

Published

Framework-agnostic core of the Pxlkit retro UI kit: design tokens, Tailwind theme, class recipes and DOM behaviour for React, Vue and Angular components

Readme


Do I need to install this?

Usually not directly — it comes with your framework's kit:

| Framework | Kit | Stylesheet | | --- | --- | --- | | React | @pxlkit/ui-kit | @import "@pxlkit/ui-kit/styles.css"; | | Vue 3 | @pxlkit/ui-kit-vue | @import "@pxlkit/ui-kit-vue/styles.css"; | | Angular | @pxlkit/ui-kit-angular | @import "@pxlkit/ui-kit-angular/styles.css"; |

Each kit's stylesheet imports Tailwind CSS v4 and this package's theme, and points Tailwind at the class names both packages use, so one @import of it — in place of @import "tailwindcss"; — is all the CSS setup there is, once Tailwind CSS v4 runs in your build (its Vite or PostCSS plugin — your kit's README has the step). Without Tailwind in the build, the components render unstyled.

Install it yourself when you build your own components on the same design system, in any framework or none:

npm install @pxlkit/ui-kit-core

What's inside

| Area | Exports | | --- | --- | | Design tokens | containerWidth, pageGutter, sectionRhythm, stackGap, rhythm, tone, durations, easings | | Vocabulary | Tone, Size, Variant, Surface types | | Surface system | surfaceClasses(surface) — the class bundle of the pixel and linear aesthetics | | Control scale | toneMap, sizeClass, sizeHeight, sizeSquare, pixelDot, pixelRadius, pixelType, focusRing, inputBase, cn | | Class recipes | Per-component class tables shared by the three kits (for example badgeVariantClasses, badgeSizeClasses) | | Pixel glyphs | PIXEL_GLYPHS, PIXEL_GLYPH_VIEWBOX, PIXEL_GLYPH_STYLE — the chevron, check and close glyphs as data | | Locale | PxlKitLocale, PXLKIT_FONTS, buildGoogleFontsUrl, toLocaleUpper, toLocaleLower, TURKISH_CHARACTERS, createLocaleContextValue | | DOM behaviour | trapFocus, getFocusableElements, lockScroll, returnFocusOnRemoval | | Floating content | toPlacement, anchoredMiddleware, anchorFloating, floatingStyles — popovers anchored with Floating UI | | Preferences | readStoredMode, writeStoredMode, resolveMode, applyResolvedMode (dark mode), matchesMediaQuery, subscribeMediaQuery, readStorage, writeStorage, removeStorage |

Everything is plain TypeScript, safe to import on the server: DOM helpers check for window / document and degrade to no-ops. The one runtime dependency is @floating-ui/dom, which positions floating content.

Examples

Compose the kit's classes in your own markup:

import { cn, focusRing, sizeClass, surfaceClasses, toneMap } from '@pxlkit/ui-kit-core';

const s = surfaceClasses('pixel');
const t = toneMap.cyan;
const className = cn('inline-flex items-center', s.border, s.radius, s.font, sizeClass.md, t.border, t.text, focusRing);

Trap focus and lock scrolling while a dialog of your own is open:

import { lockScroll, trapFocus } from '@pxlkit/ui-kit-core';

const releaseFocus = trapFocus(() => dialogElement);
const releaseScroll = lockScroll();
// …on close:
releaseFocus(); // focus returns to the element that opened the dialog
releaseScroll(); // scroll locks stack across every kit on the page

Theming

The stylesheet defines the --retro-* palette for the light theme (:root) and the dark theme (.dark on <html> or any ancestor), maps it onto Tailwind utilities (bg-retro-bg, text-retro-cyan, …) and adds the pixel utilities (pxl-corner-*, pxl-shadow*, pxl-nudge-*). Override any variable after importing your kit's stylesheet:

@import "@pxlkit/ui-kit/styles.css";

:root { --retro-green: #22c55e; }
.dark { --retro-green: #4ade80; }

Using the theme in your own styles

  • Styles Tailwind compiles separately (a Vue <style> block, Angular component styles, CSS modules) must reference the theme before @apply can use it — otherwise the build stops with Cannot apply unknown utility class 'bg-retro-…':
    @reference "@pxlkit/ui-kit-vue/styles.css"; /* or @pxlkit/ui-kit/styles.css, @pxlkit/ui-kit-angular/styles.css */
    
    .panel { @apply bg-retro-surface text-retro-text font-pixel; }
  • pxl-corner-*, pxl-shadow* and pxl-nudge-* are plain classes: use them in markup; they take no variants and @apply rejects them.
  • A cut corner (pxl-corner-*) is a clip-path, which also clips a drop shadow on the same element: put pxl-shadow on an element whose corners are whole, or on a wrapper. pxl-nudge-hover and pxl-nudge-active give the pixel press feel without the shadow — 1px on hover, 2px while pressed — as the kits' pixel buttons do.
  • On the pixel surface a cut corner clips a focus ring drawn outside the element, so keyboard focus lights the 2px edge inside: automatically on a pxl-corner-* element that takes focus; elsewhere add pxl-focus-inset with a variant (focus-visible:pxl-focus-inset, group-focus-visible:pxl-focus-inset, has-[input:focus-visible]:pxl-focus-inset). --pxl-focus-color sets its colour (currentColor; Highlight in forced-colors mode).

Related Packages

| Package | Description | | --- | --- | | @pxlkit/ui-kit | The React components | | @pxlkit/ui-kit-vue | The Vue 3 components | | @pxlkit/ui-kit-angular | The Angular components |

Documentation

Browse every component at pxlkit.xyz/ui-kit and the setup guide at pxlkit.xyz/docs.

License

MIT License — code package. See the repo licensing overview for split-license scope details.

Created by Joangel De La Rosa