# docx-editor-document-list

> Document list dialog opens named Word documents by author into the editor with title bar.

**Framework:** react  **Component:** DocxEditor  **Variant:** document-list

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/js/docx-editor-document-list.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-documenteditor @syncfusion/ej2-react-popups
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/docx-editor-document-list/DocxEditor.jsx

```jsx
import { useEffect, useRef, useState } from 'react';
import { DocumentEditorContainerComponent, Ribbon, Toolbar } from '@syncfusion/ej2-react-documenteditor';
import { DialogComponent } from '@syncfusion/ej2-react-popups';
import { defaultDocument, characterFormat, paragraphFormat, styles, weblayout } from '../datasource/docx-editor-data';
import { TitleBar } from '../title-bar';
import '../default.component.css';

DocumentEditorContainerComponent.Inject(Toolbar, Ribbon);

let gridData = [
  {
    FileName: 'Getting Started.docx', Author: 'Ryan Hodson'
  },
  {
    FileName: 'Character Formatting.docx', Author: 'Elton Stoneman'
  },
  {
    FileName: 'Paragraph Format.docx', Author: 'Peter Shaw'
  },
  {
    FileName: 'Style.docx', Author: 'Cody Lindley'
  },
  {
    FileName: 'Web Layout.docx', Author: 'Scott Allen'
  },
];

const Default = () => {
  useEffect(() => {
    // Initialize after first render to wire up title bar and editor defaults
    setTimeout(() => initContainer(), 0);
  }, []);
  const [dictionary] = useState({
    'Getting Started.docx': defaultDocument,
    'Character Formatting.docx': characterFormat,
    'Paragraph Format.docx': paragraphFormat,
    'Style.docx': styles,
    'Web Layout.docx': weblayout
  });

  const dialogRef = useRef(null);
  const containerRef = useRef(null);
  const [isDialogOpen, setDialogOpen] = useState(false);

  const hostUrl = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';

  let titleBar = null;

  function initContainer() {
    if (!containerRef.current) return;
    const editor = containerRef.current.documentEditor;

    // Title bar hookup
    const titleBarElement = document.getElementById("documenteditor_titlebar");
    if (titleBarElement) {
      titleBar = new TitleBar(
        titleBarElement,
        editor,
        true, false, dialogRef.current ? dialogRef.current : undefined
      );
    }

    // Basic defaults
    editor.pageOutline = '#E0E0E0';
    editor.acceptTab = true;
    containerRef.current.documentEditorSettings.showRuler = true;

    // Keep title updated
    containerRef.current.documentChange = () => {
      if (titleBar) titleBar.updateDocumentTitle();
      editor.focusIn();
    };

    containerRef.current.resize();
  }

  function dialogClose() {
    setDialogOpen(false);
  }

  function dialogOpen() {
    setDialogOpen(true);
    // Ensure sizing is correct when dialog is visible
    setTimeout(() => containerRef.current && containerRef.current.documentEditor ? containerRef.current.documentEditor.resize() : undefined, 0);
  }

  function openDoc(mode, row) {
    if (!containerRef.current) return;
    dialogOpen();

    const editor = containerRef.current.documentEditor;

    // Load from in-memory dictionary for demo
    if (Object.prototype.hasOwnProperty.call(dictionary, row.FileName)) {
      editor.open(JSON.stringify(dictionary[row.FileName]));
    }

    if (mode === 'View') {
      editor.isReadOnly = true;
      editor.enableContextMenu = false;

      // Hide "Share" button if available, show close button in title-bar
      const downloadButton = document.getElementById('documenteditor-share');
      if (downloadButton) downloadButton.style.display = 'none';
      const closeButton = document.getElementById('de-close');
      if (closeButton) closeButton.style.display = 'block';

      editor.documentName = row.FileName.replace('.docx', '');
      const titleEl = document.getElementById('documenteditor_title_name');
      if (titleEl) titleEl.textContent = editor.documentName;

      containerRef.current.toolbarItems = ['Open', 'Separator', 'Find'];
    } else {
      editor.isReadOnly = false;
      editor.enableContextMenu = true;

      const downloadButton = document.getElementById('documenteditor-share');
      if (downloadButton) downloadButton.style.display = 'block';
      const closeButton = document.getElementById('de-close');
      if (closeButton) closeButton.style.display = 'block';

      editor.documentName = row.FileName.replace('.docx', '');
      const titleEl = document.getElementById('documenteditor_title_name');
      if (titleEl) titleEl.textContent = editor.documentName;

      containerRef.current.toolbarItems = [
        'New', 'Open', 'Separator', 'Undo', 'Redo', 'Separator', 'Image', 'Table', 'Hyperlink',
        'Bookmark', 'TableOfContents', 'Separator', 'Header', 'Footer', 'PageSetup', 'PageNumber',
        'Break', 'InsertFootnote', 'InsertEndnote', 'Separator', 'Find', 'Separator', 'Comments',
        'TrackChanges', 'Separator', 'LocalClipboard', 'RestrictEditing', 'Separator', 'FormFields',
        'UpdateFields'
      ];
    }
    containerRef.current.resize();
  }
  return (
    <div className="control-pane documenteditor-list-sample">
      {/* Bootstrap-like table (no Syncfusion Grid) */}
      <div id="Grid" style={{ "display": "block", "height": "calc(100vh - 180px)" }}>
        <table className="table table-hover table-borderless align-middle">
          <thead>
            <tr>
              <th scope="col">File Name</th>
              <th scope="col">Author</th>
              <th scope="col" className="e-de-table-actions-header">Actions</th>
            </tr>
          </thead>
          <tbody>
            {gridData.map((row, idx) => (
              <tr key={idx}>
                <td className="file-name-cell">
                  <div>
                    <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
                      <path d="M3 3C3 1.34315 4.34315 0 6 0H16.7574C17.553 0 18.3161 0.316071 18.8787 0.87868L26.1213 8.12132C26.6839 8.68193 27 9.44699 27 10.2426V27C27 28.6569 25.6569 30 24 30H6C4.34315 30 3 28.6569 3 27V3Z" fill="#4889EF" />
                      <path d="M17.5 11H25V10.5042C25 9.76949 24.7304 9.0603 24.2422 8.51114L19.9463 3.67818C18.9974 2.61074 17.6374 2 16.2092 2H16V9.5C16 10.3284 16.6716 11 17.5 11Z" fill="#D6E5FE" />
                      <path d="M10.3044 12H10.8868H11.104H11.6817L12.6231 16.3922L13.3963 12H15L13.5719 19H12.777H12.5552H11.8943L10.993 15.0093L10.1103 19H9.44945H9.22761H8.42808L7 12H8.60832L9.38188 16.3816L10.3044 12Z" fill="white" />
                      <rect x="7" y="21" width="16" height="2" rx="1" fill="white" />
                      <rect x="7" y="25" width="11" height="2" rx="1" fill="white" />
                    </svg>
                    <span style={{ verticalAlign: 'super', marginLeft: '5px' }} title={row.FileName}>
                      {row.FileName}
                    </span>
                  </div>
                </td>
                <td className="e-de-table-author-cell">{row.Author}</td>
                <td className="e-de-table-actions-cell">
                  <button
                    type="button"
                    className="btn btn-sm btn-link text-secondary p-2 e-de-view-btn"
                    title="View"
                    onClick={() => openDoc('View', row)}
                  >
                    <span className="e-icons e-eye e-flat e-de-view-icon" aria-hidden="true"></span>
                  </button>
                  <button
                    type="button"
                    className="btn btn-sm btn-link text-secondary p-2 e-de-edit-btn"
                    title="Edit"
                    onClick={() => openDoc('Edit', row)}
                  >
                    <span className="e-icons e-edit e-flat e-de-edit-icon" aria-hidden="true"></span>
                  </button>
                </td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>

      <DialogComponent
        id="defaultDialog"
        ref={dialogRef}
        visible={isDialogOpen}
        minHeight={'90%'}
        width={'90%'}
        height={'90%'}
        isModal={true}
        open={dialogOpen}
        close={dialogClose}
      >
        <div>
          <div id="documenteditor_titlebar" className="e-de-ctn-title"></div>
          <div id="documenteditor_container_body" style={{ "display": "block", "height": "calc(100vh - 230px)" }}>
            <DocumentEditorContainerComponent showPropertiesPane={false}
              id="container" height='100%'
              ref={containerRef}
              style={{ display: "block" }}
              serviceUrl={hostUrl}
              zIndex={3000}
              enableToolbar={true}
              locale="en-US"
            />
          </div>
        </div>
      </DialogComponent>
    </div>
  );
}
export default Default;

```
