Rich text editor React component library based on Tiptap with extensive formatting controls and Mantine integration
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Pre-built controls for basic text styling including bold, italic, underline, strikethrough, and formatting removal. These controls provide immediate visual feedback and keyboard shortcut support.
Toggles bold formatting for selected text or at cursor position.
/**
* Bold text formatting control
* Keyboard shortcut: Ctrl/Cmd + B
*/
RichTextEditor.Bold: React.ComponentType;Usage Example:
<RichTextEditor.ControlsGroup>
<RichTextEditor.Bold />
</RichTextEditor.ControlsGroup>Toggles italic formatting for selected text or at cursor position.
/**
* Italic text formatting control
* Keyboard shortcut: Ctrl/Cmd + I
*/
RichTextEditor.Italic: React.ComponentType;Usage Example:
<RichTextEditor.ControlsGroup>
<RichTextEditor.Italic />
</RichTextEditor.ControlsGroup>Toggles underline formatting for selected text or at cursor position.
/**
* Underline text formatting control
* Keyboard shortcut: Ctrl/Cmd + U
*/
RichTextEditor.Underline: React.ComponentType;Usage Example:
<RichTextEditor.ControlsGroup>
<RichTextEditor.Underline />
</RichTextEditor.ControlsGroup>Toggles strikethrough formatting for selected text or at cursor position.
/**
* Strikethrough text formatting control
* Keyboard shortcut: Ctrl/Cmd + Shift + S
*/
RichTextEditor.Strikethrough: React.ComponentType;Usage Example:
<RichTextEditor.ControlsGroup>
<RichTextEditor.Strikethrough />
</RichTextEditor.ControlsGroup>Removes all text formatting from selected text, reverting to plain text.
/**
* Clear all text formatting control
* Removes bold, italic, underline, strikethrough, colors, and other formatting
*/
RichTextEditor.ClearFormatting: React.ComponentType;Usage Example:
<RichTextEditor.ControlsGroup>
<RichTextEditor.Bold />
<RichTextEditor.Italic />
<RichTextEditor.Underline />
<RichTextEditor.Strikethrough />
<RichTextEditor.ClearFormatting />
</RichTextEditor.ControlsGroup>import { useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Underline from "@tiptap/extension-underline";
import { RichTextEditor } from "@mantine/tiptap";
function TextFormattingEditor() {
const editor = useEditor({
extensions: [
StarterKit,
Underline, // Required for underline functionality
],
content: "<p>Select this text and use formatting controls!</p>",
});
return (
<RichTextEditor editor={editor}>
<RichTextEditor.Toolbar sticky stickyOffset={60}>
{/* Text formatting controls group */}
<RichTextEditor.ControlsGroup>
<RichTextEditor.Bold />
<RichTextEditor.Italic />
<RichTextEditor.Underline />
<RichTextEditor.Strikethrough />
<RichTextEditor.ClearFormatting />
</RichTextEditor.ControlsGroup>
</RichTextEditor.Toolbar>
<RichTextEditor.Content />
</RichTextEditor>
);
}All text formatting controls automatically show their active state:
Text formatting controls support standard keyboard shortcuts:
Ctrl/Cmd + BCtrl/Cmd + ICtrl/Cmd + UCtrl/Cmd + Shift + SAll controls include proper accessibility features:
Some formatting options require specific Tiptap extensions:
@tiptap/starter-kit@tiptap/extension-underlineOverride default accessibility labels for internationalization:
<RichTextEditor
editor={editor}
labels={{
boldControlLabel: "Bold (Ctrl+B)",
italicControlLabel: "Italic (Ctrl+I)",
underlineControlLabel: "Underline (Ctrl+U)",
strikeControlLabel: "Strikethrough (Ctrl+Shift+S)",
clearFormattingControlLabel: "Remove formatting",
}}
>
{/* controls */}
</RichTextEditor>Apply custom styles to formatting controls:
<RichTextEditor.Bold
styles={{
control: {
backgroundColor: 'var(--mantine-color-blue-filled)',
color: 'white'
}
}}
/>