Skip to main content

Guitar tablature

Tablature draws each string as a horizontal line and prints fret numbers on top. It's the notation most guitar and bass players read first โ€” reach for it whenever the audience is fretted-string players. Pair it with standard notation for scores that must serve both audiences, or render it alone for a tab-only chart.

Showing rhythm on a tab-only staffโ€‹

When you hide standard notation, the tab staff loses stems and beams. Turn them back on through notation.rhythmMode:

  • Hidden (default when both staves show) โ€” no rhythm indicators on the tab staff.
  • ShowWithBars โ€” each beat draws a stem with flags; grouped beats connect through a common bar under the staff.
  • ShowWithBeams โ€” same as above but individual notes use flags instead of a bar, matching the standard-notation convention.
  • Automatic โ€” Hidden when standard notation is visible, ShowWithBars when it isn't.

notation.rhythmHeight controls how far the stems drop below the tab staff (default 15), and notation.smallGraceTabNotes prints grace notes at a reduced size so they don't crowd the main fret numbers.

Because these are settings on the notation group, they apply to every staff in the render. Combine them with per-staff showTablature toggles when you need mixed layouts.

Show it in codeโ€‹

import * as alphaTab from '@coderline/alphatab';

const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
notation: {
rhythmMode: alphaTab.TabRhythmMode.ShowWithBars,
rhythmHeight: 20,
smallGraceTabNotes: true,
},
});

api.scoreLoaded.on((score) => {
for (const track of score.tracks) {
for (const staff of track.staves) {
staff.showStandardNotation = false;
staff.showTablature = true;
}
}
api.render();
});

getAlphaTabContainer() is a placeholder for the platform-specific step of obtaining the render target โ€” a <div> on Web, an AlphaTab control on .NET, or an AlphaTabView on Android. Every other line runs unchanged on all three runtimes.

Where to look nextโ€‹