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

@scalang/react

v0.0.3

Published

React components for Scalang multilingual API documentation powered by Scalar

Readme

@scalang/react

React components for rendering multilingual Scalar API references, powered by Scalang.

Provides a drop-in wrapper around @scalar/api-reference-react with a language selector bar, branding section, and theme-aware styling.

Installation

npm install @scalang/react

Peer dependencies: react, react-dom

Usage

Basic Setup

import { ScalangApiReference } from "@scalang/react";
import "@scalang/react/style.css";

export default function ApiDocs() {
  return (
    <ScalangApiReference
      configuration={{ spec: { url: "/specs/en.json" } }}
      locales={["en", "fr", "de", "ja"]}
      currentLocale="en"
    />
  );
}

Custom Locale Change Handler

By default, clicking a locale tag navigates to /{locale}. Override this with onLocaleChange:

<ScalangApiReference
  configuration={{ spec: { url: `/specs/${locale}.json` } }}
  locales={["en", "fr", "de"]}
  currentLocale={locale}
  onLocaleChange={(newLocale) => {
    router.push(`/docs/${newLocale}`);
  }}
/>

Single Locale (No Language Bar)

When only one locale is provided, the language selector bar is hidden:

<ScalangApiReference
  configuration={{ spec: { url: "/openapi.json" } }}
  locales={["en"]}
  currentLocale="en"
/>

Components

ScalangApiReference

Main wrapper component. Renders the language selector bar above Scalar's API reference viewer.

| Prop | Type | Description | | ---------------- | --------------------------------- | -------------------------------------------------------- | | configuration | ReferenceProps["configuration"] | Scalar API reference configuration | | locales | string[] | Available locale codes | | currentLocale | string | Active locale code | | onLocaleChange | (locale: string) => void | Locale change handler (default: navigate to /{locale}) |

LanguageSelector

Tag-style navigation bar with locale pills and branding. Used internally by ScalangApiReference.

| Prop | Type | Description | | ---------------- | -------------------------- | ---------------------- | | locales | string[] | Available locale codes | | currentLocale | string | Active locale code | | onLocaleChange | (locale: string) => void | Locale change handler |

Styling

Import the stylesheet for the language bar:

import "@scalang/react/style.css";

The component uses Scalar CSS custom properties for theme integration, with sensible fallbacks:

  • --scalar-sidebar-background-1 — bar background
  • --scalar-color-1 — text and tag colors
  • --scalar-color-accent — active tag highlight

Custom Styling

Override the CSS classes to customize appearance:

.scalang-lang-bar {
  /* Language bar container */
}

.scalang-lang-tag {
  /* Individual locale pill */
}

.scalang-lang-tag.active {
  /* Active locale pill */
}

.scalang-brand-section {
  /* Right-aligned branding area */
}

Responsive

The language bar is responsive — on screens ≤560px, locale tags scroll horizontally and the branding section stacks below.

Next.js Compatibility

The package includes a "use client" directive in the built output, so it works in Next.js App Router without additional configuration.

License

MIT