Text Editor - Theming

CSS variables, structural classes, and PrimeOne theme integration for customizing the Text Editor component.

#Styles

TextEditor requires a theme file along with the core styles. The default.css theme uses static values, whereas primeone.css derives its values from the PrimeUI library in use (Aura, Lara, Material, Nora, or a custom preset). The appearance is customizable by overriding individual variables or by building a custom theme file with the CSS variables listed in the next section.

#Default Theme

Recommended for projects that do not use a PrimeUI library. It pairs with the Tailwind UI parts, built on native elements and Tailwind styling.

import '@primeui/texteditor-style/themes/default.css';
import '@primeui/texteditor-style/style.css';

#PrimeOne Theme

Integrates with PrimeOne theming. Recommended for projects already using a PrimeUI library in styled mode, since the values are derived from the active preset.

import '@primeui/texteditor-style/themes/primeone.css';
import '@primeui/texteditor-style/style.css';

#Custom Theme

Build a custom theme by pairing the core styles with a stylesheet that defines every CSS variable listed in the next section.

import '@/app/styles/texteditor/app-theme.css';
import '@primeui/texteditor-style/style.css';

#CSS Variables

A theme file defines these variables. They are grouped below by what they control.

#Layout and Shape

VariableDescription
--p-text-editor-corner-radiusBorder radius for the editor container, overlays, code blocks, images, and chips
--p-text-editor-toolbar-heightToolbar height, published on the Root so siblings such as the Navigator and BlockControls offset themselves without coupling to source order
--p-text-editor-dividerBorder color for the editor outline, toolbar separator, table cells, and horizontal rules
--p-text-editor-overlay-shadowBox shadow applied to popover menus, context toolbars, and overlay panels

#Foreground

VariableDescription
--p-text-editor-foregroundMain text color for editor content
--p-text-editor-foreground-emphasisEmphasized text color used in hover states
--p-text-editor-foreground-highlightText color inside highlighted elements such as mention chips
--p-text-editor-mutedColor for placeholders, toolbar icons, and low-emphasis elements

#Background

VariableDescription
--p-text-editor-backgroundBackground color for the editor, toolbar, context toolbar, and popover menus
--p-text-editor-background-emphasisBackground color for code blocks, blockquotes, active toolbar items, and table headers
--p-text-editor-background-highlightBackground color for mention chips and highlighted elements

#Accent and State

VariableDescription
--p-text-editor-accentAccent color for links, active cell outlines, blockquote borders, drop indicators, checkboxes, and mention markers
--p-text-editor-accent-contrastContrast color paired with the accent for text on accent-colored backgrounds such as checkbox checkmarks
--p-text-editor-dangerColor for destructive actions such as delete operations
--p-text-editor-disabled-opacityOpacity for disabled toolbar items

#Selection

VariableDescription
--p-text-editor-selection-backgroundBackground color for text selection and preserved selection highlight
--p-text-editor-selection-foregroundText color for selected text

#Focus Ring

VariableDescription
--p-text-editor-focus-ring-widthWidth of the focus ring outline
--p-text-editor-focus-ring-styleStyle of the focus ring outline (e.g. solid, dashed)
--p-text-editor-focus-ring-colorColor of the focus ring outline
--p-text-editor-focus-ring-offsetOffset of the focus ring from the element edge
--p-text-editor-focus-ring-shadowBox shadow used as the focus ring indicator
The focus-ring-*, disabled-opacity, danger, and foreground-emphasis variables are used by the PrimeOne UI parts only. The Tailwind variant uses Tailwind utilities for the same surfaces instead.

#Style Classes

#Layout

ClassDescription
p-text-editorRoot container; flexbox column with border, radius, and overflow hidden
p-text-editor-toolbarToolbar region above the editor with bottom border
p-text-editor-bodyScrollable body containing the editor content
p-text-editor-contentProseMirror editable content area (contenteditable)
p-text-editor-placeholderPlaceholder text shown when the editor is empty

#Content Formatting

ClassDescription
p-text-editor-content h1–h6Headings with scaled font sizes from 2rem (h1) to 0.875rem (h6)
p-text-editor-content ulUnordered list with disc style and inline-start padding
p-text-editor-content olOrdered list with decimal style and inline-start padding
p-text-editor-content liList item with vertical margin
p-text-editor-content codeInline code with monospace font and emphasis background
p-text-editor-content preCode block with emphasis background and horizontal scroll
p-text-editor-content pre codeCode inside a code block; inherits font size, no background
p-text-editor-content blockquoteBlock quote with accent left border and emphasis background
p-text-editor-content aLinks styled with accent color and underline
p-text-editor-content imgImages constrained to max-width with border radius
p-text-editor-content hrHorizontal rule using divider color

#Checklist

ClassDescription
p-text-editor-content ul[data-p-checked-list]Checklist container with no list style
li[data-p-checked]Checklist item; data-p-checked="true" applies strikethrough + reduced opacity to text
li[data-p-checked] > labelNon-editable checkbox container (prevents accidental deletion of checkbox)
li[data-p-checked] input[type="checkbox"]Custom styled checkbox with appearance: none, accent fill, and animated checkmark

#Tables

ClassDescription
p-text-editor-table-overlayWrapper container for table overlay elements
p-text-editor-table-selection-outlineOutline drawn around the active cell or multi-cell selection
p-text-editor-table-triggerBase class for column, row, and cell trigger buttons
p-text-editor-table-trigger-colColumn trigger positioned at top center of active column
p-text-editor-table-trigger-rowRow trigger positioned at left center of active row
p-text-editor-table-trigger-cellCell trigger inside the selection outline
p-text-editor-table-addBase class for add column/row buttons
p-text-editor-table-add-colAdd column button at the inline-end edge of the table
p-text-editor-table-add-rowAdd row button at the bottom edge of the table

#Block Mode

ClassDescription
p-text-editor-blockIndividual block wrapper with relative positioning
p-text-editor-block-contentEditable content area within a block
p-text-editor-block-controlsPlus button and drag handle container; positioned via JS
p-text-editor-block-controls[data-block-type]Block type attribute for per-heading vertical alignment offsets
p-text-editor-block-placeholderPlaceholder widget inside empty blocks; inherits parent font styles
p-text-editor-block-drop-indicatorHorizontal line showing the drop target position during drag

#Navigator

ClassDescription
p-text-editor-navigatorNavigator minimap container positioned on the inline-end edge
p-text-editor-navigator-barIndividual heading bar; width varies by data-level attribute
p-text-editor-navigator-popoverHeading list popover shown on navigator hover

#Menus and Overlays

ClassDescription
p-text-editor-popover-menuPopover menu container with shadow, border, and scroll
p-text-editor-popover-submenuSubmenu panel positioned alongside the parent menu
p-text-editor-context-toolbarFloating toolbar that appears on text selection
p-text-editor-context-toolbar-moreOverflow panel for additional context toolbar actions

#Inline Decorations

ClassDescription
p-text-editor-mentionMention chip with highlight background and accent text
p-text-editor-mention-typingInline decoration marking the active mention input
p-text-editor-slash-typingInline decoration marking the slash command input
p-text-editor-selectionPreserved selection highlight when editor loses focus

#Upload Placeholders

ClassDescription
p-text-editor-image-upload-placeholderPlaceholder block for image upload UI
p-text-editor-document-upload-placeholderPlaceholder block for document upload UI

#Animations

ClassDescription
p-text-editor-anchored-overlay-enter-activeEntry animation for popover menus and context toolbars (scale + fade)
p-text-editor-anchored-overlay-leave-activeExit animation for popover menus and context toolbars (scale + fade)

#Data Attributes

Every part renders data-scope="texteditor" and a data-part="<name>" on its root element, the stable styling and testing contract that survives class-name changes. The Root also publishes data-id, data-disabled, and data-readonly. See Data Attributes for the full list of parts and state attributes.