Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/react

Package Overview
Dependencies
Maintainers
5
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/react

React components for tiptap

  • 2.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
695K
increased by3.75%
Maintainers
5
Weekly downloads
 
Created

What is @tiptap/react?

@tiptap/react is a headless, framework-agnostic text editor built on top of ProseMirror. It provides a highly customizable and extensible rich text editor for React applications.

What are @tiptap/react's main functionalities?

Basic Editor Setup

This code sets up a basic Tiptap editor with the StarterKit extension, which includes common features like bold, italic, and lists.

import React from 'react';
import { useEditor, EditorContent } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';

const Tiptap = () => {
  const editor = useEditor({
    extensions: [StarterKit],
    content: '<p>Hello World!</p>',
  });

  return <EditorContent editor={editor} />;
};

export default Tiptap;

Custom Extensions

This code demonstrates how to create a custom extension for Tiptap. The custom extension defines a new node type that can be used within the editor.

import { Node, mergeAttributes } from '@tiptap/core';

const CustomExtension = Node.create({
  name: 'customExtension',
  group: 'block',
  content: 'inline*',
  parseHTML() {
    return [{ tag: 'custom-extension' }];
  },
  renderHTML({ HTMLAttributes }) {
    return ['custom-extension', mergeAttributes(HTMLAttributes), 0];
  },
});

export default CustomExtension;

Collaboration

This code sets up a collaborative editing environment using Tiptap and Yjs with WebRTC. Multiple users can edit the same document in real-time.

import { Collaboration } from '@tiptap/extension-collaboration';
import { WebrtcProvider } from 'y-webrtc';

const editor = useEditor({
  extensions: [
    StarterKit,
    Collaboration.configure({
      document: ydoc,
    }),
  ],
});

const provider = new WebrtcProvider('your-room-name', ydoc);

Other packages similar to @tiptap/react

Keywords

FAQs

Package last updated on 13 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc