ABCScore
The <ABCScore> React component renders ABC notation on screen.
Installation
pnpm add @music-ui/reactUsage
The following code renders a score with the passed notes:
import { ABCScore } from "@music-ui/react";
import '@music-ui/abc/styles.css';
function App() {
return (
<main>
<h1>My App</h1>
{/* rest of your app */}
<ABCScore>
CDEF GABc|
</ABCScore>
</main>
);
}Output:
Without time signature:
With free tempo:
Component props
The component accepts the following props:
| Name | Type | Default Value | Description |
|---|---|---|---|
children | string | The abc notation content | |
showTempo | boolean | true | Displays or hides the score tempo indicator |
showTimeSignature | boolean | true | Displays or hides the time signature |
abcOptions | object | DEFAULT_ABC_VISUAL_PARAMS | The options passed to the abcjs renderer |
id | string | The score unique identifier | |
className | string | The component class name |
Props showcase
A showcase of the component props:
import { ABCScore } from "@music-ui/react";
import "@music-ui/abc/styles.css";
function App() {
return (
<>
<ABCScore showTempo={false}>
CDEF GABc|
</ABCScore>
<ABCScore showTimeSignature={false}>
CDEF GABc|
</ABCScore>
<ABCScore abcOptions={{ foregroundColor: "orange" }}>
CDEF GABc|
</ABCScore>
</>
);
}showTempo
showTimeSignature
abcOptions
Last updated on