Tab strip
- β / β
- Move focus to the previous / next tab
- Home / End
- Jump to the first / last tab
- Enter / Space
- Activate the focused tab
- Double-click
- Minimize / restore the ribbon
The ribbon follows the WAI-ARIA tab + toolbar pattern with Office-style shortcuts. Click anywhere in the ribbon first to put focus inside it.
data-key-tip="X"Screen-reader users also hear announcements (aria-live="polite") for ribbon minimize / restore, contextual-tab show / hide, and overflow-group collapse / expand transitions.
Copy-paste starting points for the most common ribbon shapes. Every element has a React wrapper (Bs*) over a Lit web component (mp-*); these snippets show the React form.
<BsRibbon minimized={minimized} onMinimizedChange={setMinimized}> <BsRibbonTab tabId="home" label="Home"> <BsRibbonGroup groupId="clipboard" label="Clipboard" dialogLauncher="Clipboard Dialog"> <BsRibbonButton itemId="paste" label="Paste" icon="π" size="large" tooltip="Paste (Ctrl+V)" onItemClick={onPaste} /> <BsRibbonButton itemId="cut" label="Cut" icon="βοΈ" size="small" onItemClick={onCut} /> <BsRibbonButton itemId="copy" label="Copy" icon="π" size="small" onItemClick={onCopy} /> </BsRibbonGroup> </BsRibbonTab></BsRibbon>The minimized prop + onMinimizedChange handler mirror Angular's two-way [(minimized)] β Ctrl+F1 and double-clicking a tab will fire the event and update your state.
<BsRibbonSplitButton itemId={pasteMode.id} label={pasteMode.label} icon={pasteMode.icon} size="large" onMainAction={onPaste}> <BsRibbonMenuItem itemId="paste" label="Paste" icon="π" onMenuSelect={onPasteModeSelect} /> <BsRibbonMenuItem itemId="paste-values" label="Paste Values" icon="123" onMenuSelect={onPasteModeSelect} /> <BsRibbonMenuSeparator /> <BsRibbonMenuItem itemId="paste-special" label="Paste Specialβ¦" onMenuSelect={onPasteSpecial} /></BsRibbonSplitButton>The split-button never mutates its own label / icon. Implement the "last-used" pattern in your component by updatingpasteMode inside onPasteModeSelect.
<BsRibbonToggleButton itemId="bold" label="Bold" icon="B" size="small" pressed={boldOn} onPressedChange={setBoldOn} /><BsRibbonComboBox itemId="font-family" label="Font Family" size="medium" options={fontFamilyOptions} value={fontFamily} onValueChange={setFontFamily} /><BsRibbonColorPicker itemId="font-color" label="Font Color" size="small" value={fontColor} onColorChange={setFontColor} />Every value-bearing wrapper (toggle-button, check-box, combo-box, color-picker, group-button) exposes a value prop + a matchingon*Change event β the standard React controlled-component pattern.
<BsRibbonContextualTabSet label="Picture Tools" color="#F2C744" visible={pictureSelected}> <BsRibbonTab tabId="picture-format" label="Format"> <BsRibbonGroup groupId="picture-styles" label="Picture Styles"> β¦ </BsRibbonGroup> </BsRibbonTab></BsRibbonContextualTabSet>Toggling hidden on the set firescontextual-visibility-change; the ribbon re-processes its slot and announces "Picture Tools, contextual, now available / hidden" via the live region.
<BsQuickAccessToolbar aria-label="Quick Access Toolbar" touchMode={touchMode}> <BsRibbonButton itemId="save" label="Save" icon="πΎ" size="small" onItemClick={onSave} /> <BsRibbonButton itemId="undo" label="Undo" icon="βΆ" size="small" onItemClick={onUndo} /></BsQuickAccessToolbar><BsRibbon β¦> β¦ </BsRibbon>The QAT is deliberately rendered as a sibling β two top-levelrole="toolbar" regions keep the a11y tree flat. Persistence of pinned commands is up to your app.
<BsRibbon version="office-2016" className="excel" /* .excel { --bs-ribbon-accent: #217346; } */ colorScheme="auto" touchMode="auto"> β¦</BsRibbon>version picks one of office-2007 /2010 / 2013 / 2016. The --bs-ribbon-accent custom property, set on the ribbon or any ancestor, drives the brand colour (Word#2B579A, Excel #217346, etc.).colorScheme="auto" followsprefers-color-scheme and ancestordata-bs-theme="dark".
{/* Any element works as an icon: an SVG, an icon-font <i>, an image. It is sized from the size the item renders at. */}<BsRibbonButton itemId="save" label="Save" size="large" onItemClick={onSave} iconTemplate={<i className="bi bi-save" />} /><BsRibbonButton itemId="copy" label="Copy" size="small" onItemClick={onCopy} iconTemplate={<svg viewBox="0 0 16 16">β¦</svg>} />Every item takes an iconTemplate element alongside theicon string prop. The element is sized from the size the item renders at, so it follows the ribbon as groups collapse. Theicon string remains the fallback β consumers can mix-and-match.