logo

Aki UI

アキ ウイ

Editor

エディター

A block editor with a slash command menu, a selection bubble menu, task lists, syntax highlighted code blocks and inline tables. Built with Tiptap↗↗, cmdk↗↗ and Tailwind CSS.

Installation

Install the following dependencies:1

npm install @tiptap/react @tiptap/core @tiptap/pm @tiptap/starter-kit @tiptap/suggestionnpm install @tiptap/extension-code-block-lowlight @tiptap/extension-list @tiptap/extension-table @tiptap/extension-text-style @tiptap/extension-typography @tiptap/extension-subscript @tiptap/extension-superscript @tiptap/extensionsnpm install lowlight tippy.js fuse.js cmdk lucide-reactnpm install @radix-ui/react-popover @radix-ui/react-dropdown-menu @base-ui-components/react

Copy and paste the following code into a new component file:2

"use client"

import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import * as PopoverPrimitive from "@radix-ui/react-popover"
import { Tooltip as TooltipPrimitive } from "@base-ui-components/react/tooltip"
import type { Editor, Range } from "@tiptap/core"
import { mergeAttributes, Node } from "@tiptap/core"
import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight"
import { TaskItem, TaskList } from "@tiptap/extension-list"
import Subscript from "@tiptap/extension-subscript"

How to use it3

"use client"

import { useState } from "react"
import {
EditorBubbleMenu,
EditorCharacterCount,
EditorClearFormatting,
EditorFloatingMenu,
EditorFormatBold,
EditorFormatItalic,

Props

EditorProvider

NameDefaultDescription
content—

string | JSONContent

Initial document, as HTML or tiptap JSON

placeholder—

string

Text shown while the document is empty

limit—

number

Maximum number of characters accepted by the editor

extensions[]

Extension[]

Extra tiptap extensions appended to the defaults

editorContainerProps{}

HTMLAttributes<HTMLDivElement>

Props forwarded to the element wrapping the ProseMirror surface

darkfalse

boolean

Applies the dark palette to the portalled menus, popovers and tooltips

className—

string

Additional classes on the editor shell

onUpdate—

(props: { editor: Editor }) => void

Called on every document change

children—

ReactNode

Menus and counters rendered inside the editor context

EditorBubbleMenu

NameDefaultDescription
children—

ReactNode

Toolbar sections, a vertical divider is inserted between each of them

options—

FloatingUIOptions

Floating UI placement options forwarded to tiptap

shouldShow—

(props) => boolean

Overrides when the menu appears

className—

string

Additional classes on the menu surface

EditorFloatingMenu

NameDefaultDescription
children—

ReactNode

Buttons shown at the start of an empty line

shouldShow—

(props) => boolean

Overrides when the menu appears

className—

string

Additional classes on the menu surface

EditorSelector

NameDefaultDescription
title—

string

Label of the dropdown trigger

open—

boolean

Controls the popover

onOpenChange—

(open: boolean) => void

Called when the popover opens or closes

darkinherited

boolean

Overrides the dark flag coming from EditorProvider

children—

ReactNode

Node buttons listed inside the popover

EditorLinkSelector

NameDefaultDescription
open—

boolean

Controls the popover

onOpenChange—

(open: boolean) => void

Called when the popover opens or closes

darkinherited

boolean

Overrides the dark flag coming from EditorProvider

Node buttons

NameDefaultDescription
hideNamefalse

boolean

Renders an icon-only square button instead of an icon with a label

Format buttons

NameDefaultDescription
hideNamefalse

boolean

Renders an icon-only square button instead of an icon with a label

EditorTableMenu

NameDefaultDescription
children—

ReactNode

Table menus, hidden unless the cursor sits inside a table

EditorTableColumnMenu / EditorTableRowMenu

NameDefaultDescription
children—

ReactNode

Dropdown items such as EditorTableColumnBefore or EditorTableRowDelete

darkinherited

boolean

Overrides the dark flag coming from EditorProvider

EditorTableGlobalMenu

NameDefaultDescription
children—

ReactNode

Icon actions pinned under the table, each one carries a tooltip

EditorCharacterCount

NameDefaultDescription
children—

ReactNode

Label rendered before the count

className—

string

Additional classes on the counter chip