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

@oceanswave/solari-split-flap

v1.0.2

Published

A realistic split-flap (Solari board) display component for React + TypeScript. Cycles through quotes with authentic mechanical flip animations and synthesised click sounds.

Downloads

175

Readme

Solari Split-Flap Display

A realistic split-flap (Solari board) display for the web. Cycles through quotes with authentic mechanical flip animations and optional click sounds via the Web Audio API.

Inspired by the classic electromechanical displays found in airports and train stations worldwide.

Solari Board License

Features

  • Authentic split-flap flip animation using CSS 3D transforms
  • Character drum cycling — characters flip through the full alphabet like a real Solari board
  • Mechanical click sound via Web Audio API (synthesized, no audio files needed)
  • Controlled mode — drive the board from React state, animate on prop changes
  • Uncontrolled mode — auto-cycle through a list of quotes
  • Imperative ref APIflipTo() and clear() for programmatic control
  • onAnimationComplete callback when all cells finish flipping
  • Custom drum characters — define your own character set
  • Responsive scalingscale prop scales all dimensions proportionally
  • Per-line colours — any row can have its own CSS colour
  • @ shorthand still works for gold author attributions
  • Helper utilities for easy text input — just pass plain strings
  • Fully tested with Vitest + React Testing Library
  • Linted and formatted with Biome
  • Available as both a standalone HTML page and a React + TypeScript component

Quick Start — Standalone HTML

Open demo/index.html in your browser. That's it — no build step, no dependencies.

React Component

npm install @oceanswave/solari-split-flap

Controlled mode — drive it from React state

Pass a single value and the board animates to it whenever it changes. No auto-cycling — you own the state.

import { useState } from 'react';
import { SolariBoard, textToQuote } from '@oceanswave/solari-split-flap';

function App() {
  const [message, setMessage] = useState(textToQuote('Hello world', 20));

  return (
    <>
      <SolariBoard value={message} />
      <button onClick={() => setMessage(textToQuote('Goodbye world', 20))}>
        Change
      </button>
    </>
  );
}

Uncontrolled mode — auto-cycle through quotes

import { SolariBoard, parseQuotes } from '@oceanswave/solari-split-flap';

const quotes = parseQuotes([
  'The only limit is your imagination.',
  'Stay hungry. Stay foolish.',
  'Make it simple, but significant.',
]);

function App() {
  return <SolariBoard quotes={quotes} />;
}

Imperative ref — programmatic control

import { useRef } from 'react';
import { SolariBoard, textToQuote } from '@oceanswave/solari-split-flap';
import type { SolariBoardHandle } from '@oceanswave/solari-split-flap';

function App() {
  const boardRef = useRef<SolariBoardHandle>(null);

  return (
    <>
      <SolariBoard ref={boardRef} />
      <button onClick={() => boardRef.current?.flipTo(textToQuote('New message', 20))}>
        Flip
      </button>
      <button onClick={() => boardRef.current?.clear()}>
        Clear
      </button>
    </>
  );
}

Animation complete callback

<SolariBoard
  value={message}
  onAnimationComplete={() => console.log('All cells done flipping!')}
/>

Responsive sizing

<SolariBoard scale={0.5} />   {/* half size — great for mobile */}
<SolariBoard scale={2} />     {/* double size — for large displays */}

Custom drum characters

<SolariBoard drum=" 0123456789:.APM" />   {/* clock-style: digits, colon, AM/PM */}

With authors (gold attribution)

const quotes = parseQuotes([
  { text: 'The only thing we have to fear is fear itself.', author: 'FDR' },
  { text: 'I think, therefore I am.', author: 'Descartes' },
]);

Custom colours per quote

const quotes = parseQuotes([
  { text: 'System online.', color: '#4ade80' },
  { text: 'Warning: disk full.', color: '#f87171' },
  { text: 'Welcome aboard!', color: '#60a5fa', author: 'Captain' },
  { text: 'Danger!', color: '#ff4444', author: 'System', authorColor: '#aaaaaa' },
]);

Per-line colour control

Each line in a quote can be a plain string or a { text, color? } object — mix and match freely:

const quotes = [
  [
    { text: 'RED ALERT', color: '#ff4444' },
    { text: 'ALL SYSTEMS', color: '#ffffff' },
    { text: 'NOMINAL', color: '#4ade80' },
  ],
  [
    'PLAIN WHITE LINE',
    { text: 'GOLD ACCENT', color: '#f5c542' },
    '@CLASSIC AUTHOR STYLE',       // still works — gold via @ prefix
  ],
];

<SolariBoard quotes={quotes} />

Board-wide default colour

<SolariBoard defaultColor="#60a5fa" />   {/* all text blue unless overridden */}

Word-wrap a single string

import { textToQuote } from '@oceanswave/solari-split-flap';

textToQuote('The quick brown fox jumps over the lazy dog.', 20)
textToQuote('Alert!', 20, { color: '#ff4444', author: 'System', authorColor: '#aaa' })

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | Quote | — | Controlled mode. Board animates to this value on change. When set, quotes/holdMs are ignored. | | quotes | Quote[] | Built-in quotes | Uncontrolled mode. Array of quotes to auto-cycle through. Ignored when value is set. | | ref | Ref<SolariBoardHandle> | — | Imperative handle with flipTo(quote) and clear() methods. | | cols | number | 20 | Number of columns (characters per row) | | rows | number | 8 | Number of rows | | defaultColor | string | '#f0f0f0' | Default text colour for rows without an explicit colour | | scale | number | 1 | Scale multiplier for cell dimensions. 0.5 = half size, 2 = double, etc. | | drum | string | ' A-Z0-9.,…' | Custom drum character sequence. Flaps cycle through this ordered string. | | holdMs | number | 5000 | Milliseconds to hold each quote before clearing | | charDelay | number | 50 | Stagger delay (ms) between cell animations | | flipMs | number | 150 | Duration of a single flap flip | | minGap | number | 35 | Fastest drum-step interval (ms) | | maxGap | number | 160 | Slowest drum-step interval (ms) | | sound | boolean | true | Enable/disable flip click sounds | | onAnimationComplete | () => void | — | Fired when all cells finish flipping to their targets. | | className | string | '' | Additional CSS class for the board | | style | object | {} | Additional inline styles for the board |

Exports

import { SolariBoard, textToQuote, parseQuotes } from '@oceanswave/solari-split-flap';
import type { SolariBoardProps, SolariBoardHandle, Quote, QuoteLine, TextToQuoteOptions } from '@oceanswave/solari-split-flap';

Types

type QuoteLine = string | { text: string; color?: string };
type Quote = QuoteLine[];

interface SolariBoardHandle {
  flipTo: (quote: Quote) => void;
  clear: () => void;
}

interface TextToQuoteOptions {
  author?: string;
  color?: string;         // body line colour
  authorColor?: string;   // author line colour (default: '#f5c542' gold)
}

Development

npm install
npm run test          # Vitest
npm run test:watch    # Vitest in watch mode
npm run lint          # Biome check
npm run lint:fix      # Biome auto-fix
npm run format        # Biome format
npm run typecheck     # TypeScript --noEmit
npm run ci            # Biome ci + typecheck + tests
npm run build         # Compile to dist/

How It Works

Each cell in the grid consists of four layers:

  1. Top flap — shows the top half of the current character
  2. Bottom flap — shows the bottom half of the new character (revealed as the top flap falls)
  3. Flip front — animated element showing the old character's top half, rotates down
  4. Flip back — backface of the flip, shows the new character's bottom half

The flip animation uses rotateX(-180deg) with backface-visibility: hidden and transform-style: preserve-3d for realistic 3D flipping.

Characters cycle through a drum (SPACE → A-Z → 0-9 → punctuation) to reach their target, just like a real mechanical display where each flap must pass through all intermediate characters.

Timing decelerates toward the target character (fast start, slow finish) for a natural mechanical feel.

License

MIT