npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ooxml-ui

v2.7.0

Published

Shared, format-neutral web components and styles for the Office viewers (Word, PowerPoint, Excel)

Readme

ooxml-ui

The Office user interface as web components: ribbons, dialogs, menus, status bars and the Word, Excel, PowerPoint, Visio and Teams editors.

npm version license types

Live demo  ·  Docs  ·  Changelog  ·  Report a bug

ooxml-ui is the DOM layer of ooxml: the shared Office controls (Lit custom elements with shadow roots, typed events and one --office-* token theme) and the product editors as ooxml-ui/<product> subpaths. All document logic lives in ooxml-core; this package only draws and reports what the user does.

Using an editor? You do not need to install this package. Every editor package (docx-*-viewer, xlsx-*-viewer, pptx-*-viewer, visio-*-viewer and openteams-*-viewer) depends on it and registers the elements for you. Install ooxml-ui directly to build your own Office-style UI from its controls, to mount an editor element without a framework package, or to write a binding of your own.

  • Office behaviour built in. Ribbon tabs and groups with KeyTips, Tell me, backstage, menus with submenus, galleries, colour pickers, dialogs that keep focus, and F6 between the regions of every editor.
  • One theme for everything. Every colour, length and duration is an --office-* token with a default, so the elements render with or without the installed theme and follow a container's data-office-theme="light" | "dark" | "auto", forced colours and touch targets.
  • Accessible by contract. Accessible names contain the visible text, form boundaries reach 3:1 contrast, and every change is checked with axe and keyboard tests in a real browser.
  • Framework neutral. Plain custom elements that are safe to import during server rendering, plus ooxml-ui/bindings, the kit the React, Vue and Solid bindings of every product are built from.

Install

npm install ooxml-ui

lit and ooxml-core come with it. Optional peers: react (18 or newer), vue (3.5) and solid-js (1.9) for ooxml-ui/bindings/react, /vue and /solid; three for PowerPoint's 3D charts and models; ai for the PowerPoint assistant (ooxml-ui/pptx/ai).

Quick start

import { registerOfficeUi } from 'ooxml-ui';

registerOfficeUi(); // installs the theme and defines every shared element; idempotent
const button = document.createElement('office-ui-button');
button.setAttribute('label', 'Save');
button.setAttribute('command', 'save');
button.addEventListener('office-command', (event) => console.log(event.detail.command));
document.body.append(button);

The product editors register themselves when their entry is imported:

import 'ooxml-ui/docx'; // defines <docx-editor>

const editor = document.createElement('docx-editor');
document.body.append(editor);
await editor.load(bytes); // a .docx as Uint8Array or ArrayBuffer

For an application, prefer the editor package of your framework (Word, Excel, PowerPoint, Visio, OpenTeams): it wraps these elements with props, events, storage and collaboration wiring.

Entries

| Entry | Contents | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | ooxml-ui | Everything below except the product editors, plus registerOfficeUi() and OFFICE_UI_TAGS. | | ooxml-ui/theme | THEME_CSS, OFFICE_TOKENS, installOfficeUiTheme(), applyOfficeLook(), shadcnBridge() and themeBridge(). | | ooxml-ui/icons | The icon registry (registerIcon, getIcon, listIcons) and <office-ui-icon>. | | ooxml-ui/controls | Buttons, form controls, ribbon, menus, dialogs, status bar, backstage and the host services below. | | ooxml-ui/presence | <office-ui-presence>, the avatar stack for collaboration awareness. | | ooxml-ui/smartart | <office-ui-smartart>, the SmartArt picker, text pane and Design galleries. | | ooxml-ui/chart-format-locales | The Chart Format pane's own translations (CHART_FORMAT_STRINGS), for a product dictionary to extend. | | ooxml-ui/teams | The Teams elements and <teams-app>. | | ooxml-ui/bindings | The framework binding kit; /bindings/react, /vue and /solid are its component factories. | | ooxml-ui/suite | The browser document and add-in preference persistence the Office suite and demos use. | | ooxml-ui/docx | The Word editor and viewer elements (<docx-editor>). | | ooxml-ui/xlsx | The Excel editor and viewer elements (<xlsx-editor>). | | ooxml-ui/visio | The Visio editor and viewer elements (<visio-viewer>). | | ooxml-ui/pptx | The PowerPoint renderer, editor and web components; also /pptx/theme, /loader, /i18n, /ai, /dom, /onedrive. |

Most entries declare an import and a default condition, so CommonJS consumers on Node 20.19+ or 22.12+ load them through require(esm); the ooxml-ui/pptx entries also ship a CommonJS build. custom-elements.json (the package's customElements field, also exported as ooxml-ui/custom-elements.json) lists every element with its attributes, properties and events for editor tooling.

Theming

Put the shared --office-* tokens and data-office-theme="light" | "dark" | "auto" on a common ancestor of the editor and any standalone controls. Two editors on one page can use different modes, auto follows the system, and changing a token or the attribute never remounts an editor or touches document content (paper, cell fills and slide artwork stay as the file says).

<section class="office-scope" data-office-theme="dark">
	<!-- the editor and its standalone controls -->
</section>
.office-scope {
	--office-accent: #0d9488;
	--office-accent-foreground: #ffffff;
	--office-ring: #0f766e;
	--office-font: 'Inter', system-ui, sans-serif;
	--office-radius: 6px;
}
  • Tokens. OFFICE_TOKENS (from ooxml-ui/theme) is the single table of tokens and defaults: semantic colours (--office-foreground, -background, -surface, -selected, -border, -accent, -ring, -danger, ...), contrast roles (--office-accent-ink, --office-control-border), --office-color-scheme, and scales (--office-space-*, --office-radius-*, --office-font-size-*, --office-control-height-*, --office-shadow-*, --office-duration-*, --office-z-*). Derived tokens such as --office-select-background resolve where they are read, so overriding --office-background or --office-accent on a container also changes the controls inside it.
  • Colour scheme. The Word, Excel and Visio editors take their color-scheme from --office-color-scheme. A container that sets only CSS color-scheme: dark gets light editors; use data-office-theme="dark", which sets both.
  • Looks. data-office-look="cards" (or applyOfficeLook(element, 'cards')) changes the chrome's shape, elevation and density, never a colour; PowerPoint uses it today. Put it on the document root when a product attaches floating menus to body.
  • Shadow roots. installOfficeUiTheme() installs one stylesheet in the document; pass a ShadowRoot to scope it, or use installOfficeUiThemeFor(element) for every enclosing shadow root. Product canvases and prepareOfficeUiBlock() do this for you.
  • Product variables. The products' own --dve-*, --xve-*, --vv-* and --pptx-* overrides still work and win for that product. shadcnBridge(':host', '--dve-') or themeBridge(selector, map) feed every --office-* colour from an existing variable set.

The theme is separate from an Office document's embedded theme. The token map and style rules are recorded in shared UI decisions.

Ribbon add-in tabs

A host can add its own ribbon tabs after a product's tabs, as an Office add-in does. The tab is plain data, and the same descriptor works in every editor: ribbonAddIns is a property of <docx-editor>, <xlsx-editor> and <visio-viewer>, and a prop of every framework binding, PowerPoint's included.

import type { RibbonAddInTab } from 'ooxml-ui';

const tab: RibbonAddInTab = {
	id: 'reports',
	label: 'Reports',
	groups: [
		{
			label: 'Export',
			commands: [
				{ id: 'export', label: 'Export', icon: 'save', run: () => exportReport() },
				{ id: 'options', label: 'Options', icon: 'settings', size: 'small' },
				{ id: 'send', label: 'Send', items: [{ id: 'send-mail', label: 'By mail' }] },
			],
		},
	],
};
editor.ribbonAddIns = [tab];
editor.addEventListener('office-ribbon-add-in', (event) => {
	const { tab, command } = event.detail; // 'reports', 'export'
});

A command runs its run callback, then dispatches the bubbling, composed office-ribbon-add-in event; it never reaches the product's own command router. size: 'small' commands fill columns of three and items makes a drop-down. A tab whose id is empty, repeated or equal to a built-in tab is skipped, so an add-in cannot replace a product tab. Assigning a new array each render is cheap and never closes an open drop-down. The descriptor types are DOM-free and live in ooxml-core/ribbon. Products render the list with syncRibbonAddIns(ribbon, tabs, options).

setOfficeAddInCatalog(editor, entries) exposes trusted host commands in the shared Office Add-ins dialog (Get Add-ins, My Add-ins), and setOfficeAddInStorefront(editor, ...) turns on its Store pivot, which is off by default.

Upload My Add-in installs an add-in-only XML manifest, a unified JSON manifest or a .zip app package after a consent step. Installs stay in editor memory unless the host passes a preference store with setOfficeAddInPreferences (the suite and demos use the IndexedDB store from ooxml-ui/suite). setOfficeAddInMarketplaceResolver lets a host resolve a Marketplace link or WA... asset id through its own backend; the library never fetches one itself. setOfficeAddInRuntime runs compatible task panes in sandboxed frames from HTTPS origins the host approves, and only after the host sets frameSrcEnforced: true once its page's CSP frame-src allowlist is in place. Word and Excel give a pane a text selection bridge. Marketplace resolution and execution are off by default, and the dialog, validator and runtime load on first use. See the add-ins plan and PRIVACY.md.

Framework binding kit

ooxml-ui/bindings is the machinery every product's framework adapters share (Word, Excel, Visio and Teams), so a product binding only declares what is its own. A BindingContract lists each forwarded prop with its forwarding policy, each element event with its handler name and arguments, and the imperative handle; bindElement(element, contract, handlers) listens and forwards. createReactBinding (/bindings/react), defineVueBinding (/vue) and createSolidBinding (/solid) turn a contract into a component; Angular and Svelte components stay in each product because they need their compilers. The kit has no framework imports and touches no DOM at import. See the binding kit guide.

PowerPoint renderer (ooxml-ui/pptx)

  • DOM renderer. ooxml-ui/pptx/dom renders a parsed slide without a framework: loadPresentation() resolves pictures and media through the core handler, and renderSlideStage() with createDefaultRegistry() draws a slide into a Document at the scale you ask for. The host owns navigation, media and playback; the renderer does not edit or collaborate on its own.
  • Lifetimes. Call disposePptxRenderStage(stage) before removing a stage (thumbnails and export stages too) and revokeBlobUrls() on the URLs loadPresentation() returned. releasePptxRenderCaches() empties the bounded render caches once every viewer sharing the module has closed.
  • Fonts. buildFontCatalog (also at ooxml-ui/pptx/render/font-catalog) builds the font picker rows; includeWeightVariants: true adds weight faces. See font loading.
  • Symbol fonts. When Wingdings or Symbol is missing, known characters map to Unicode with a bundled Noto Sans Symbols 2 subset (inline WOFF2, no request). It is an approximation; host CSP must allow font-src data:.
  • Headless controllers. Undo history, autosave and recovery, and the collaboration session are framework-free controllers (getSnapshot(), subscribe(), typed actions) that each binding adapts with one store adapter.

Host services

ooxml-ui/controls (and the package root) export helpers product hosts reuse: createLiveColorInput for preview and commit colour transactions, createDialogSession for asynchronous submit and dismissal, the font services buildFontCatalog, scanAvailableFontFamilies and createFontFaceScope, and createRecoveryScheduler. Dispose font scopes and sessions when the host unmounts. For your own storage, use DocumentStorage and createStorageSession; for OneDrive, ooxml-core/embedding/onedrive, with Microsoft sign-in supplied by the host.

Elements

| Tag | Attributes / properties | Events (all bubble, composed) | | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | office-ui-button | label, icon, command, disabled, pressed, expanded, icon-only, variant="stacked", keyshortcuts | office-command { command } | | office-ui-checkbox, office-ui-switch | checked, disabled, value, aria-label; form-associated | input, change | | office-ui-select | <option> / <optgroup> children (data-display-label, data-description, font previews) or the options property [{ value, label, disabled? }]; value, selectedIndex, disabled, aria-label, variant="ribbon-font" or "ribbon-icon", data-font-picker; icon and custom slots; arrows, Home, End, PageUp/PageDown, typeahead | input, change | | office-ui-ribbon-group | label, launcher (dialog launcher command), launcher-disabled; default slot | launcher: office-command { command } | | office-ui-ribbon-stack | orientation="horizontal"; default slot (three-row column of small commands by default) | none | | office-ui-menu-button / -menu-item | button: label, icon, command (split button), variant, disabled, keyshortcuts; item: command, label, icon, disabled, checked | item choice: office-command { command } | | office-ui-toolbar | aria-label, aria-orientation; arrow-key focus movement | none | | office-ui-dialog | open, heading, dismissible="false", show(), close(); slots default, footer | office-dialog-close { reason } (cancelable), office-dialog-closed after focus returns | | office-ui-status-bar / -status-item | label, value, interactive, id; controlled bar: state { items?, toggles?, views?, zoom? } with summary, collaboration and end slots | office-status-activate { id } | | office-ui-zoom-slider | value (percent), min, max, step, disabled, fit (fit button name), label | input, change; fit: office-command { command: 'zoom-fit' } | | office-ui-color-grid | Office's colour picker body: themeColors (ten base colours; Theme Colors grid with lighter and darker variants), themeNames (a product's own column names), variantLabel (names a variant swatch, for a translated product), palette (the Theme Colors grid as a product computes it, in place of themeColors), selectedTheme ({ column, variant? }, marks a theme swatch by position), extraColors (one more theme-bound row), standardColors (empty leaves the row out), recentColors, value, none-label, automatic-label, more-label, label, disabled; events office-color-pick { color, source, label, theme?, index? } (a theme swatch reports its column and variant so a product can save a theme reference) and office-color-more. In a pane narrower than the grid the swatches shrink to fit; --office-color-swatch-gap sets the space between them. The palette maths is ooxml-core/color (buildThemePalette) | | office-ui-color-custom | The Custom tab of Office's Colors dialog: a hue and saturation square, a luminance slider, Hex, Red/Green/Blue and Hue/Sat/Lum fields (0-255) and New over Current swatches. value (#rrggbb), current, label, disabled, valid; event office-color-change { color } | | office-ui-tab-strip | tabs [{ id, label, title? }], selected, label, previous-label, next-label, add-label, add-disabled, add-title, disabled | office-tab-select { id } (cancelable); add: office-command { command: 'tab-add' } | | office-ui-context-menu / office-ui-menu-separator | Children mode: label, openAt(x, y), close(), open over office-ui-menu-item and separator children. Controlled mode: state { x, y, label, items: [{ id, label, separatorBefore?, heading?, danger?, disabled?, checked?, icon? }], markers?, zIndex?, autoFocus? }; arrows, Home, End and type-ahead in both | children: item office-command { command }; controlled: office-menu-request { id }, office-menu-close { reason } (never closes itself) | | office-ui-command-search | commands [{ id, label, keywords?, description?, disabled?, title? }], placeholder, label, limit (Office's "Tell me what you want to do") | choice: office-command { command } | | office-ui-options-dialog | categories [{ id, label, description?, disabled?, sections: [{ id, title, controls }] }] (controls: toggle, select, number, text, each optionally disabled with a reason), values, category, open, heading, show(), close() | OK: office-options-change { values, changed } | | office-ui-account | profile { displayName, avatarColor, initial? }; slots sign-in and default (product sections) | office-profile-change { profile } | | office-ui-ribbon | Tab row over tab panels. Panels are children with data-ribbon-tab, data-label, optional data-tab-keytip; slots quick-access, search, end, actions (right end of the tab row); selected, label, file-label, no-file, file-expanded, file-keytip; focusFile(), focusTab() | office-ribbon-select { tab } (cancelable), office-ribbon-file | | office-ui-backstage | items [{ id, label, group?: 'footer', disabled?, title? }], open, selected, label, back-label, show(page?), close(); pages are children with data-backstage-page | office-backstage-select { id } (cancelable), office-backstage-close { reason } (cancelable) | | office-ui-find-bar | open, label, input-label, placeholder, maxlength, disabled, navigation-disabled, previous-label, next-label, close-label; value, status, statusTitle, show(), close() | office-find-input { query }, office-find-step { direction }, office-find-close | | office-ui-ruler | orientation="vertical", origin (px offset of zero), scale (px per unit, default 96), direction="reverse"; decorative | none | | office-ui-print-preview | pages (rendered nodes; an inert clone of the current one is shown), index, label, empty-label | office-print-preview-page { index } | | office-ui-radio | checked, disabled, value, name; radios of one tag sharing a name form a roving-focus group; form-associated | input, change | | office-ui-search | value, placeholder, disabled, aria-label, variant="titlebar"; focus(), select() | input, change | | office-ui-ribbon-toggle | label, checked, disabled, title, command (a labelled ribbon checkbox row; static checkboxTag picks the inner checkbox) | office-toggle { command, checked } | | office-ui-dialog-footer | state { actions: [{ id, label, variant?, icon?, disabled?, busy?, title?, align?, testId? }] }, focusAction(id) | office-dialog-footer-request { id } | | office-ui-toasts | state { toasts: [{ id, code?, severity, message }], overflowCount?, labels? }; hidden when empty, host positions it | office-toasts-request { id: 'dismiss', toastId } or { id: 'dismissAll' } | | office-ui-read-only-banner | state { kind, message, passwordPromptOpen?, passwordError?, checkingPassword?, labels? } | office-read-only-request (Edit anyway, Dismiss, password submit or cancel) | | office-ui-message-bar | state { kind (security, info), title, message, actionLabel?, closeLabel? }; the Office Message Bar under the ribbon | office-message-bar-request ({ id: action } for the action button, { id: close }) | | office-ui-signature-status | summary (a SignatureSummary from ooxml-core/opc), locale, variant (badge, notice, panel), no-activate; hidden while the document is unsigned | office-signature-activate (badge), office-signature-dismiss (notice) | | office-ui-progress-dialog | state { open, title, progress, status, cancelLabel? }; a modal with a role="progressbar" (0 to 100) and a polite status line; Escape and the backdrop do nothing; focus moves to Cancel and returns on close | office-progress-cancel (Cancel) | | office-ui-paste-options | state { left, top, options: [{ id, label }], label? }; fixed 4px past the pasted object | office-paste-options-request { format }, office-paste-options-dismiss | | office-ui-title-bar | state { appMark?, fileName, status?, tone?, autosave?, quickAccess?: { label, items, showLabels? }, search? }, placement (titleBar, belowRibbon); slots collaboration, account; tokens --office-title-bar-* | office-autosave-toggle, office-command { command }, office-command-search { query, command? } | | office-ui-ribbon-section | groups [{ id, label, commands: [{ id, label, icon, title?, size?, badge?, disabled?, active?, compact?, hidden?, caret?, pressed?, expanded?, column? }] }]; keyed groups and commands in the light DOM | the commands' own events (office-command) | | office-ui-gallery | state { id, label, moreLabel?, disabled?, command?, sections: [{ title?, columns, tileWidth, tileHeight, items: [{ id, label, applied?, preview? }] }], inline? }, mode (inline, panel), compact (a panel of unlabelled tiles), chevron-only, icon; open, disabled, close(); tiles in light DOM (data-gallery-item), previews parsed by parseSvgPreview | office-gallery-pick { gallery, itemId } | | office-ui-comments-pane | threads [{ id, anchorLabel?, resolved, comments: [{ id, author, initials?, color?, created?, text, edited? }] }], activeThreadId, read-only (controls disabled), list-only (navigation list only), closable, add-disabled, currentAuthor (may edit own comments), labels (every string), classNames ({ thread?, comment? } product hook classes), locale; arrows, Home and End between threads, Enter or Space selects | comment-add { text }, comment-reply { threadId, text }, comment-edit { threadId, commentId, text }, comment-delete { threadId, commentId }, thread-resolve / thread-reopen / thread-select { threadId }, comments-close | | office-ui-presence | participants, max, label | office-presence-select { id } | | office-ui-smartart | drawing (core DiagramDrawing), schemeColors, schemeFonts, label | office-smartart-render (render report) | | office-ui-smartart-picker | categories, layouts, labels, drawPreview, value, category, items-editor, accent | office-smartart-change (every c