Skip to content

Framework bindings ​

All bindings mount <xlsx-editor> through the same mountEditor function in packages/bindings/src/index.ts, so every framework gets identical semantics.

Props ​

PropTypeDefaultNotes
workbookWorkbooknoneShown when a new object is passed. The workbook the editor emits is never assigned back (no loop).
bytesUint8Array | ArrayBuffernoneFile bytes; loaded again whenever a new array is passed.
srcstringnoneURL fetched and loaded when the string changes; the file name defaults to the URL's last segment.
fileNamestringBook1.xlsxForwarded only when the parent changes it, so File > Open in the editor can rename the workbook.
readOnlybooleanfalse
localestringenen, fr, de, es, zh-CN or a tag that maps to one (de-DE).
theme'light' | 'dark' | 'auto'autoauto follows the operating system.
authorNamestringAuthorRecorded on new comments.
showToolbarbooleantrueThe ribbon.
showFormulaBarbooleantrueThe name box and formula bar.
hiddenActionsstring[][]Ribbon controls to hide, by stable id.
themeColorsPartial<Record<...>>{}Token overrides, see theming.

Callbacks and events ​

Callback (React, Solid, vanilla)Vue eventAngular outputSvelte propPayload
onWorkbookChangeworkbook-changeworkbookChangeonworkbookchangeWorkbook
onWorkbookErrorworkbook-errorworkbookErroronworkbookerrorError
onSelectionChangeselection-changeselectionChangeonselectionchange{ sheet, ref, active }
onDirtyChangedirty-changedirtyChangeondirtychangeboolean
onReadOnlyChangereadonly-changereadOnlyChangeonreadonlychangeboolean
onRibbonCustomizeribbon-customizeribbonCustomizeonribboncustomizestring[] (hidden actions)
onReadyreadyreadyonreadythe <xlsx-editor> element

Load failures (corrupt, encrypted or unsupported files) reach onWorkbookError; a failed src fetch does too. A src fetch still in flight is dropped when new bytes or a new workbook arrive, or src is cleared or changed. The element's other events (workbook-warning, file-command, sheet-change, ribbon-action) are listened to on the element itself, see the element API.

Every prop is forwarded only when its value changes (hiddenActions and themeColors are compared by value), so a parent re-render never undoes what the user changed inside the editor: Editing / Viewing, File > Options theme or language, or Customize Ribbon. A controlled parent keeps its state in step through onReadOnlyChange and onRibbonCustomize (in Angular, [(readOnly)]).

Handle ​

Every adapter exposes the same handle: React through ref, Vue through the template ref, Angular through the component instance, Solid through editorRef, Svelte through the component's exports and vanilla as the return value of mountEditor.

MemberEffect
elementThe mounted <xlsx-editor>.
load(bytes, fileName?)Opens .xlsx, .xlsm, .xls or .csv bytes; rejects on failure.
newWorkbook()Replaces the workbook with a blank one.
save()Resolves to an .xlsx Blob. Does not clear dirty.
saveBytes(format?)'xlsx' (default) or 'csv' (active sheet) bytes.
download(fileName?)Saves, downloads in the browser and marks the workbook clean.
markClean()Clears dirty after you persisted a saved Blob yourself.
select(ref), getSelection()Selection as an A1 reference ('B2:D8').
setActiveSheet(index)Switches sheet.
dirtyUnsaved edits (Svelte: isDirty()).

Calling a handle method before the editor is mounted throws Editor is not mounted.

Server rendering ​

Every package imports without a DOM. Registration (defineXlsxEditor) and mounting are client operations.

Released under the Apache-2.0 License.