For AI agents: the complete documentation index is available at https://a3s-lab.github.io/Office/docs/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/Office/docs/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/Office/docs/en/guide/index.md.
  • English
  • latest
  • Getting started

    Install the library and import its shared stylesheet once in the host application.

    bun add @a3s-lab/office
    DocumentPage.tsx
    import { useState } from 'react';
    import type { DocumentContent } from '@a3s-lab/office/core';
    import { DocumentEditor } from '@a3s-lab/office/react';
    import '@a3s-lab/office/styles.css';
    
    const initialContent: DocumentContent = {
      type: 'document',
      html: '<h1>Project brief</h1><p>Start editing here.</p>',
      pageSize: 'a4',
    };
    
    export function DocumentPage() {
      const [content, setContent] = useState(initialContent);
    
      return (
        <main style={{ height: '100vh', minHeight: 0 }}>
          <DocumentEditor content={content} onChange={setContent} />
        </main>
      );
    }

    Controlled content

    Every editable component is controlled. The editor emits a complete typed content value through onChange; the host owns persistence, collaboration, versioning, and the value passed back into the component.

    Do not persist rendered DOM as the primary file model. Keep the structured content returned by the editor, and use the package import/export APIs at file boundaries.

    Package entry points

    ImportPurpose
    @a3s-lab/office/coreContent types, artifact helpers, import, export, and preload APIs
    @a3s-lab/office/reactReact editor components
    @a3s-lab/office/vueVue component bindings
    @a3s-lab/office/web-componentCustom-element registration
    @a3s-lab/office/styles.cssRequired editor and design-system styles

    Host layout

    Editors fill their host. Give the host a definite height and allow nested flex or grid children to shrink with min-height: 0 and min-width: 0.

    .office-editor-host {
      width: 100%;
      height: 100dvh;
      min-width: 0;
      min-height: 0;
    }

    Continue with the framework bindings or open the DocumentEditor API.