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

@chordkit/react

v1.0.8

Published

React components and hooks for chordkit — ChordChart, ChordProgression, ChordEditor

Readme

@chordkit/react

React components and hooks for chordkit — render chord diagrams, progressions, and interactive editors with zero boilerplate.

Install

npm install chordkit @chordkit/react

Peer dependencies: react >= 17, react-dom >= 17.

ChordChart

Renders a single chord diagram as an inline SVG. Accepts all ChordChartOptions plus className and style.

import { ChordChart } from '@chordkit/react'
import { guitar } from '@chordkit/dictionary'

function App() {
  return (
    <ChordChart
      chord={guitar.Am}
      theme="dark"
      width={260}
    />
  )
}

With all options:

<ChordChart
  chord={guitar.F}
  instrument="guitar"
  theme="light"
  autoFinger
  noteLabels="sharp"
  leftHanded={false}
  animate={{ loop: true }}
  width={200}
  className="my-chord"
  style={{ display: 'inline-block' }}
/>

ChordProgression

Renders multiple chord diagrams side by side in a single SVG.

import { ChordProgression } from '@chordkit/react'
import { guitar } from '@chordkit/dictionary'

function App() {
  return (
    <ChordProgression
      chords={[guitar.Am, guitar.F, guitar.C, guitar.G]}
      instrument="guitar"
      theme="dark"
      spacing={16}
      chordWidth={200}
      title="Verse"
    />
  )
}

ChordEditor

Interactive chord editor — click fret positions to place/remove fingers, click string tops to toggle open/muted. Browser-only; renders an empty div during SSR.

import { ChordEditor } from '@chordkit/react'
import { guitar } from '@chordkit/dictionary'

function App() {
  return (
    <ChordEditor
      instrument="guitar"
      theme="light"
      initialChord={guitar.Am}
      onChange={(chord) => console.log(chord)}
    />
  )
}

ChordEditor props

| Prop | Type | Description | |------|------|-------------| | instrument | string \| object | Instrument preset or custom config | | theme | string \| object | Theme preset or custom | | leftHanded | boolean | Mirror the editor for left-handed players | | width | number | Editor width in pixels | | initialChord | ChordDiagram | Chord to pre-load on mount | | onChange | (chord: ChordDiagram) => void | Called on every user interaction | | className | string | CSS class for the wrapper div | | style | CSSProperties | Inline styles for the wrapper div |

useChordEditor hook

For full programmatic control over the editor instance.

import { useChordEditor } from '@chordkit/react'
import { guitar } from '@chordkit/dictionary'

function MyEditor() {
  const { ref, chord, setChord, clear } = useChordEditor({
    instrument: 'guitar',
    theme: 'dark',
    onChange: (c) => console.log('changed', c),
  })

  return (
    <div>
      <div ref={ref} />

      <button onClick={() => setChord(guitar.Am)}>Load Am</button>
      <button onClick={() => setChord(guitar.G)}>Load G</button>
      <button onClick={clear}>Clear</button>

      {chord && (
        <pre>{JSON.stringify(chord, null, 2)}</pre>
      )}
    </div>
  )
}

Hook return value

| Key | Type | Description | |-----|------|-------------| | ref | RefObject<HTMLDivElement> | Attach to the container element | | chord | ChordDiagram \| null | Current chord state (updates on every click) | | setChord | (chord: ChordDiagram) => void | Load a chord programmatically | | clear | () => void | Remove all fingers and reset string states |

SSR

ChordChart and ChordProgression are fully SSR-safe — they call ChordChart.svg() synchronously (no DOM access).

ChordEditor and useChordEditor initialize the interactive layer only in the browser (typeof window !== 'undefined'). During SSR they render an empty <div> without errors.

Related packages

| Package | Description | |---------|-------------| | chordkit | Core library — SVG rendering, themes, export, interactive editor | | @chordkit/dictionary | Pre-built chord definitions for guitar, ukulele, and more | | @chordkit/theory | Transpose chords, build scales, identify chords from notes | | @chordkit/parser | Parse chord names and chord sheets with embedded [Am] markers | | @chordkit/detect | Chord detection from MIDI numbers, frequencies, or note names |

License

MIT