Skip to main content

ChordChart

Renders a professional musician's chart: measures with chord symbols, slash notation, section labels, rehearsal marks, and bar lines. The format you'd hand to a session player.

A
1A
Cm7F7
////
2
Bbmaj7
////
3
Ebmaj7Am7b5
////
4
D7Gm
////

Usage

import { ChordChart, createScore, createTrack, createMeasure, createChord } from 'react-notation'
import 'react-notation/style.css'

const score = createScore({
timeSignature: { beats: 4, value: 4 },
keySignature: { root: 'G', mode: 'major' },
tracks: [
createTrack({
measures: [
createMeasure({
number: 1,
section: 'A',
rehearsalMark: 'A',
events: [
createChord({ beat: 1, duration: 'half', symbol: 'Cm7', root: 'C', quality: 'min7' }),
createChord({ beat: 3, duration: 'half', symbol: 'F7', root: 'F', quality: 'dominant7' }),
],
}),
createMeasure({
number: 2,
events: [createChord({ beat: 1, duration: 'whole', symbol: 'Bbmaj7', root: 'Bb', quality: 'maj7' })],
barline: 'final',
}),
],
}),
],
})

<ChordChart score={score} />

Props

PropTypeDefaultDescription
scoreMusicScoreRequired. Only the first track is rendered.
measuresPerLinenumber4Maximum measures per visual line.
breakAtSectionsbooleantrueStart a new line when a measure has a section label.
showSlashesbooleantrueRender slash notation (/ / / /) below chord symbols.
showMeasureNumbersbooleanfalseShow bar numbers inside each measure.
classNamestringAdditional CSS class on the root element.
...restHTMLAttributes<HTMLDivElement>All standard div props forwarded.

ChordChart is a forwardRef component.

Rehearsal marks

Set rehearsalMark on a Measure to render a boxed label (e.g. [A], [Bridge]) inside that bar:

createMeasure({ number: 1, rehearsalMark: 'A', events: [...] })

Barlines

Set barline on a Measure to render special barlines at the end of that bar:

ValueRenders
'single'Default single bar line
'double'Double bar line (thicker right edge on the line)
'final'Final double bar (thick + thin)
'repeat-end'Repeat end marker
'repeat-start'Repeat start marker

Slash notation

When showSlashes is true, one / is rendered per beat below the chord row. The number of slashes is derived from score.timeSignature.beats.

Theming

ChordChart uses the same --notation-* tokens as ChordSheet, plus:

TokenDefaultControls
--notation-color-measure-bordercurrentColorBar line and measure box border
--notation-font-size-chord1remChord symbols
--notation-font-weight-chord600Chord symbol weight
--notation-font-size-label0.75remMeasure numbers and rehearsal marks
--notation-color-lyricinheritSlash notation color

Interactive / editor mode

Pass a ScoreEditor (from useScore) to activate interactive mode — chord selection and data-notation-* attributes for popup anchoring.

import { ChordChart, useScore, createScore } from 'react-notation'

function Editor() {
const editor = useScore(initialScore)
return <ChordChart score={editor.score} editor={editor} onSelect={console.log} />
}
PropTypeDefaultDescription
editorScoreEditorReturned by useScore. Activates interactive mode.
onSelect(sel: Selection) => voidFired when a chord is focused or clicked.

See the Editing guide for the full useScore API.

Known limitations

  • Only the first track is rendered.
  • Slash count is uniform across a measure — beat-accurate slash positioning is not yet supported.
  • Repeat barlines are rendered via CSS pseudo-elements; complex repeat structures (D.S., D.C.) are not yet supported.