@lightsonfire/chord-diagram-react
v0.3.0
Published
Chord diagrams for React on the web: inline SVG, drawn from the shared layout.
Readme
@lightsonfire/chord-diagram-react
Guitar chord diagrams for React on the web, drawn as inline SVG. Pass in a shape, get back a diagram.
npm install @lightsonfire/chord-diagram-reactimport { ChordCard, ChordLibrary, type Chord } from "@lightsonfire/chord-diagram-react";
const cadd9: Chord = { name: "Cadd9", frets: [-1, 3, 2, 0, 3, 3], fingers: [0, 2, 1, 0, 3, 4] };
export function Chords() {
return (
<div style={{ display: "flex", gap: 12 }}>
<ChordCard chord={ChordLibrary.C} style={{ width: 148 }} />
<ChordCard chord={cadd9} style={{ width: 148 }} showDownload format="png" />
</div>
);
}- Components:
ChordDiagram(the diagram alone),ChordCard(with name, caption and export link) andChordSheet(a full demo sheet) - Data:
fretsrun low E to high e, with-1muted and0open;fingers,barreandcaptionare optional - Export:
chordSvg,chordPnganddownloadChord - Accessible: each diagram is an image labelled with a spoken description of the shape
The same diagrams are available for React Native (@lightsonfire/chord-diagram-react-native), SwiftUI and Jetpack Compose. See the full README for more examples.
MIT licensed.
