Ritext
Extensions

Sub & Superscript

A combined dropdown for subscript and superscript formatting.

The SubAndSuperscript extension renders a single dropdown button that contains both subscript and superscript options. It automatically loads the Tiptap subscript and superscript extensions.

Import

import { SubAndSuperscript } from 'ritext/extension/subandsuperscript';

Usage

const extensions = [SubAndSuperscript];

Do not use both SubAndSuperscript and individual Subscript/Superscript extensions at the same time. Choose one approach.

Configuration

SubAndSuperscript.configure({
  subscript: 'Subscript',       // Label for the subscript option
  superscript: 'Superscript',   // Label for the superscript option
  showCommandText: true,        // Show keyboard shortcuts in dropdown
})

Options

Prop

Type

Keyboard Shortcuts

ActionWindows / LinuxmacOS
Toggle SubscriptCtrl+,⌘+,
Toggle SuperscriptCtrl+.⌘+.

On this page