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

@swiss-ui/react

v0.1.0

Published

React components for Swiss UI design system

Readme

@swiss-ui/react

Headless React components for Swiss UI design system.

Installation

npm install @swiss-ui/react
yarn add @swiss-ui/react
pnpm add @swiss-ui/react

Usage

Headless import

All components are exported from the root entry with no default styles attached. You provide all styling yourself.

import { Button, Input, Modal } from '@swiss-ui/react'

You can also import individual components from their own sub-paths to enable more granular code splitting:

import { Button } from '@swiss-ui/react/button'
import { Input } from '@swiss-ui/react/input'

Styled import

The @swiss-ui/react/styled entry re-exports every component with a swiss-* CSS class pre-applied. Apply the swiss-ui CSS token sheet and component stylesheet alongside this entry to get themed components out of the box.

import { Button, Input, Stack } from '@swiss-ui/react/styled'

Components

| Component | Description | Key props | |---|---|---| | Box | Generic polymorphic container | as | | Text | Inline or block text | as, size, weight, align, truncate | | Container | Centered max-width wrapper | size (sm / md / lg / xl / full) | | Stack | Vertical flex container | gap, align, justify | | Grid | CSS grid container | cols, gap, align | | GridItem | Grid child with span support | colSpan, rowSpan | | Heading | Semantic heading h1-h6 | level, size, weight, align, as | | Button | Polymorphic action trigger | variant, size, loading, leftIcon, rightIcon, as | | Input | Text input with addons | size, invalid, leftAddon, rightAddon, describedBy | | Textarea | Multi-line text input | size, invalid, resize, autoResize, describedBy | | Select | Native select element | size, invalid, placeholder, describedBy | | Checkbox | Checkbox with indeterminate state | indeterminate, invalid | | Radio | Radio button | invalid | | RadioGroup | Radio group context provider | name, value, onChange, orientation | | Switch | Toggle switch | checked, defaultChecked, onChange | | Badge | Inline status indicator | variant, color | | Alert | Contextual message block | variant, icon, title, description, actions | | Spinner | Loading indicator | size, color, label | | Modal | Accessible dialog | isOpen, onClose | | ModalOverlay | Modal backdrop | | | ModalContent | Dialog container with focus trap | | | ModalHeader | Header slot | | | ModalBody | Body slot, provides aria-describedby | | | ModalFooter | Footer slot | | | ModalCloseButton | Pre-wired close button | | | Tooltip | Hover/focus tooltip | content, placement, delay, disabled | | Dropdown | Menu dropdown container | | | DropdownTrigger | Menu trigger button | | | DropdownContent | Menu panel | | | DropdownItem | Menu action item | disabled | | DropdownSeparator | Visual separator | | | DropdownLabel | Non-interactive group label | |

Accessibility

The following accessibility features are implemented out of the box:

  • All interactive elements use native HTML elements or appropriate ARIA roles.
  • Button supports polymorphic rendering; when rendered as a non-button element, aria-disabled is set instead of the disabled attribute.
  • Input, Textarea, and Select expose aria-invalid and aria-describedby props.
  • Checkbox supports the indeterminate state via the DOM property.
  • RadioGroup renders a radiogroup role; Radio buttons share a name from context.
  • Switch uses role="switch" with aria-checked.
  • Alert maps info and success variants to role="status" and warning / error to role="alert".
  • Spinner exposes role="status" with a configurable aria-label.
  • Modal locks body scroll, traps focus inside ModalContent, and closes on Escape.
  • Tooltip renders role="tooltip" inside a portal and links to the trigger via aria-describedby.
  • Dropdown follows the ARIA menu button pattern: aria-haspopup, aria-expanded, aria-controls, and full keyboard navigation (ArrowUp / ArrowDown / Home / End / Escape / Tab).

Customization

Components use CSS custom properties for all design tokens. Override them on :root or any ancestor element:

:root {
  --swiss-font-size-md: 1rem;
  --swiss-spacing-4: 1rem;
  --swiss-color-primary: #0055cc;
}

The data-variant, data-size, data-color, and data-component attributes on every element give you CSS attribute selectors without any class naming convention:

[data-component="button"][data-variant="solid"] {
  background: var(--swiss-color-primary);
}

SSR compatibility

All portal-based components (Modal, Tooltip, Dropdown) guard against document access with typeof document !== 'undefined' checks, making them safe to render in server environments. They hydrate correctly on the client without any additional configuration.