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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@scalar/components

v0.16.11

Published

Scalars component library

Readme

Scalar Components

Storybook Version Downloads License Discord

Scalar Components provides a library of components used across Scalar products. The library is designed to work seamlessly with our theming system and includes a scoped copy of the themes reset, base variables and colors.

Want to explore the components? Check out the Storybook for a live demo.

Installation

pnpm i @scalar/components

Scoping

Because many Scalar applications are embedded into other websites the components reset and styles are scoped to the scalar-app class. This means you need to add this class to the root element of your application where you want the to use the components. If you are using the components in a standalone application, you can just add this class to the body element.

<body class="scalar-app">
  <!-- Use components in here -->
</body>

Usage

To get started, import the CSS styles in your main setup file (e.g., main.ts, index.ts, or App.vue):

import '@scalar/components/style.css'

Then, you can use the components in your Vue components. For example:

<script
  setup
  lang="ts">
  import { ScalarButton } from '@scalar/components'
</script>
<template>
  <ScalarButton />
</template>

Customizing Components

Most components can be customized using props. For example, the ScalarButton component can be customized with the variant prop to change the variant of the button.

<ScalarButton variant="ghost" />

However, sometimes you need to override the default styles. Most components (soon to be all) use the useBindCx function to apply the Tailwind classes to the component. The function intelligently merges the component's classes with the provided classes allowing you to override preset classes.

<!-- A button you need to be really big -->
<ScalarButton class="h-24 w-48" />

This will apply the h-24 w-48 classes to the button and remove the sizing classes that would normally be applied by default. For more information see the useBindCx function.

Floating Components

The component library includes a number of floating components including the ScalarPopover, ScalarDropdown, and ScalarListbox as well as a ScalarFloating primitive. All of the components use Floating UI under the hood and provide the same for interacting with the Floating UI API.

When using the floating components the default slot renders reference / target element (e.g. a button) and a named slot renders the floating element (e.g. a menu). For example:

<ScalarPopover>
  <!-- Reference element -->
  <ScalarButton>Open</ScalarButton>
  <template #popover>
    <!-- Floating element -->
  </template>
</ScalarPopover>

Since you can directly target the reference element with Tailwind classes any classes applied to the base component will be applied to the floating element (using useBindCx under the hood). For example:

<!-- Will apply the class `w-48` to the floating element (the popover) -->
<ScalarPopover class="w-48">
  <!-- Will apply the class `w-full` to the reference element (the button) -->
  <ScalarButton class="w-full">Open</ScalarButton>
  <template #popover> ... </template>
</ScalarPopover>

CSS Layers

The components package uses the same CSS Layers as the themes package to apply the theme styles. For more information see the themes README.

Testing

The components library uses both unit testing (vitest) and snapshot testing to ensure quality and visual consistency. Snapshot tests are written using Playwright and capture screenshots of Storybook stories to detect visual regressions.

For detailed information about the testing setup, see the test README.

Contributing

All pull requests should include the following checklist:

## Component Checklist

- [ ] Exported from `@scalar/components`
- [ ] Has JSDocs for all:
  - [ ] Components (with examples)
  - [ ] Props
  - [ ] Slots
  - [ ] Emits
  - [ ] Functions
  - [ ] Types
- [ ] Allows overriding of Tailwind classes where applicable (see useBindCx)
- [ ] Has stories showcasing any applicable variants
- [ ] Has unit tests covering any applicable interactions
- [ ] Has snapshot tests covering any visual variations