Next.js에 통합

설치 및 기본 사용로 시작하십시오. 아래 예로는 Next.js 앱 라우터를 사용하여 Univer Pdf를 컨테이너에 명시된 높이로 마운트합니다.

ssr: false1 클라이언트 구성 요소에서 편집기를로드하십시오. use client 지시어는 혼자서 사전 렌더링을 비활성화하지 않습니다. Next.js를 참조하십시오.

YOUR_CLIENT_LICENSE가 나타낸 클라이언트 라이선스 콘텐츠를 배치합니다. 파일 경로는 여기에 작동하지 않습니다. 라이센스 구성를 참조하십시오.

통합 단계

  1. useEffect에서 Univer 인스턴스를 만듭니다.
  2. useEffect의 정리 함수에서 인스턴스를 해제합니다.

플러그인 설정

UniverUIPlugin

  • container
    string | HTMLElement
    편집기를 마운트할 DOM 요소 또는 요소 ID입니다.

UniverLicensePlugin

  • license
    string
    클라이언트 라이선스 파일의 내용입니다.

예제 코드

각 마운트는 자신의 아이 컨테이너를 가져옵니다. Disposal은 React 정리 후 마이크로 작업에서 실행되므로 React 루트가 React 커밋에서 비동기적으로 마운트되지 않습니다.

TSX
'use client'import { useEffect, useRef } from 'react'import { UniverLicensePlugin } from '@univerjs-pro/license'import { UniverPdfsPlugin } from '@univerjs-pro/pdfs'import { UniverPdfsUIPlugin } from '@univerjs-pro/pdfs-ui'import PdfsUIkoKR from '@univerjs-pro/pdfs-ui/locale/ko-KR'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { FUniver } from '@univerjs/core/facade'import DesignkoKR from '@univerjs/design/locale/ko-KR'import { UniverUIPlugin } from '@univerjs/ui'import UIkoKR from '@univerjs/ui/locale/ko-KR'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs-pro/pdfs-ui/lib/index.css'import '@univerjs-pro/pdfs/facade'export default function UniverEditor() {  const containerRef = useRef<HTMLDivElement>(null)  useEffect(() => {    const host = containerRef.current    if (!host) return    const container = document.createElement('div')    container.style.height = '100%'    host.append(container)    const univer = new Univer({      locale: LocaleType.KO_KR,      locales: {        [LocaleType.KO_KR]: mergeLocales(          DesignkoKR,          UIkoKR,          PdfsUIkoKR,        ),      },    })    univer.registerPlugin(UniverLicensePlugin, {      license: 'YOUR_CLIENT_LICENSE',    })    univer.registerPlugin(UniverUIPlugin, { container })    univer.registerPlugin(UniverPdfsPlugin)    univer.registerPlugin(UniverPdfsUIPlugin)    const univerAPI = FUniver.newAPI(univer)    univerAPI.createPdf({ name: 'Untitled PDF' })    return () => {      queueMicrotask(() => {        univer.dispose()        container.remove()      })    }  }, [])  return <div ref={containerRef} style={{ height: 600 }} />}
TSX
'use client'import dynamic from 'next/dynamic'const UniverEditor = dynamic(() => import('./univer-editor'), { ssr: false })export default function Page() {  return <UniverEditor />}

Footnotes

  1. 서버 사이드 렌더링(SSR)은 브라우저가 페이지를 로드하기 전에 렌더링 코드를 실행합니다. 이 환경에는 window와 DOM이 없습니다. Client Component도 사전 렌더링될 수 있으므로 편집기 컴포넌트의 SSR을 별도로 꺼야 합니다. ↩

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.