Notation Presets

Register and resolve notation presets that control how chord qualities are rendered.


Functions

definePreset

definePreset(name: string, preset: Partial<NotationPreset>): void

Register a named notation preset. Fields not specified in `preset` fall back to `DEFAULT_PRESET`. Once registered, the preset can be referenced by name wherever a `notation-preset` attribute or option is accepted.

resolvePreset

resolvePreset(nameOrPreset: string | Partial<NotationPreset> | undefined): NotationPreset

Resolve a notation preset to a complete `NotationPreset` object. - `undefined` → returns `DEFAULT_PRESET` - string → looks up a registered preset by name (throws if unknown) - partial object → merges with `DEFAULT_PRESET`


Types

NotationPreset interface

Controls how chord qualities are rendered as HTML strings. Each field is an HTML fragment appended after the chord root. Fields accept any inline HTML — the built-in presets use `<sup>`, `<small>`, and Unicode glyphs to produce typographically correct chord symbols. Unspecified fields fall back to `DEFAULT_PRESET` when passed to `definePreset`.

add6: string
Added 6th suffix (e.g. `<sup>6</sup>`).
dim7: string
Diminished 7th suffix (e.g. `<sup><small>o</small>7</sup>`).
diminished: string
Diminished triad suffix (e.g. `<sup><small>o</small></sup>`).
dom11: string
Dominant 11th suffix (e.g. `<sup>11</sup>`).
dom13: string
Dominant 13th suffix (e.g. `<sup>13</sup>`).
dom7flat13: string
Dominant 7♭13 suffix (e.g. `<sup>7♭13</sup>`).
dom7flat5: string
Dominant 7♭5 suffix (e.g. `<sup>7♭5</sup>`).
dom7flat9: string
Dominant 7♭9 suffix (e.g. `<sup>7♭9</sup>`).
dom7sharp5: string
Dominant 7♯5 / augmented 7th suffix (e.g. `<sup>7♯5</sup>`).
dom7sharp9: string
Dominant 7♯9 suffix (e.g. `<sup>7♯9</sup>`).
dom9: string
Dominant 9th suffix (e.g. `<sup>9</sup>`).
dominant7: string
Dominant 7th suffix (e.g. `<sup>7</sup>`).
halfDiminished: string
Half-diminished / minor 7♭5 suffix (e.g. `<sup><small>ø</small></sup>`).
maj7: string
Major 7th suffix (e.g. `<sup><small>△</small></sup>`).
major: string
Major quality suffix. Typically empty — the root alone implies major.
min7: string
Minor 7th suffix (e.g. `<small>m</small><sup>7</sup>`).
minor: string
Minor quality suffix (e.g. `<small>m</small>`).
sus2: string
Suspended 2nd suffix (e.g. `<sup><small>sus2</small></sup>`).
sus4: string
Suspended 4th suffix (e.g. `<sup><small>sus4</small></sup>`).

Constants

DEFAULT_PRESET

const DEFAULT_PRESET: NotationPreset

Default notation preset. Uses Unicode musical glyphs (♭ ♯ ø ° △) and HTML superscripts.

REALBOOK_PRESET

const REALBOOK_PRESET: NotationPreset

Real Book chord symbol dialect (e.g. CMA7, CMI, CMI7(♭5)).