Single Line

Loading...
Files
components/single-line-demo.tsx
'use client';

import React from 'react';

import { SingleLinePlugin } from '@udecode/plate-break/react';
import { Plate } from '@udecode/plate-common/react';

import { editorPlugins } from '@/components/editor/plugins/editor-plugins';
import { useCreateEditor } from '@/components/editor/use-create-editor';
import { singleLineValue } from '@/components/values/single-line-value';
import { Editor, EditorContainer } from '@/components/plate-ui/editor';

export default function SingleLineDemo() {
  const editor = useCreateEditor({
    plugins: [...editorPlugins, SingleLinePlugin],
    value: singleLineValue,
  });

  return (
    <Plate editor={editor}>
      <EditorContainer variant="demo">
        <Editor />
      </EditorContainer>
    </Plate>
  );
}

Features

  • Limits editor to one block of text. Suitable for brief content or titles.

Installation

npm install @udecode/plate-break

Usage

import { SingleLinePlugin } from '@udecode/plate-break/react';
 
const plugins = [
  // ...otherPlugins
  SingleLinePlugin,
];

Plugins

SingleLinePlugin