mui-tiptap
Version:
A Material-UI (MUI) styled WYSIWYG rich text editor, using Tiptap
60 lines (59 loc) • 2.42 kB
TypeScript
import { type ToggleButtonProps } from "@mui/material/ToggleButton";
import { type SxProps } from "@mui/material/styles";
import type { ReactNode, RefObject } from "react";
import { type MenuButtonClasses } from "./MenuButton.classes";
import { type MenuButtonTooltipProps } from "./MenuButtonTooltip";
export type MenuButtonProps = Omit<ToggleButtonProps, "ref" | "children" | "className" | "classes" | "value"> & {
/**
* The `value` for the toggle button. If not provided, uses the tooltipLabel
* as the value.
*/
value?: ToggleButtonProps["value"];
/**
* The label that will be displayed in a tooltip when hovering. Also used as
* the underlying ToggleButton `value` if a separate `value` prop is not
* included.
*/
tooltipLabel: MenuButtonTooltipProps["label"];
/**
* (Optional) An array of the keyboard shortcut keys that trigger this action
* will be displayed in a tooltip when hovering. If empty, no keyboard
* shortcut is displayed.
*
* Use the literal string "mod" to represent Cmd on Mac and Ctrl on Windows
* and Linux.
*
* Example: ["mod", "Shift", "7"] is the array that should be provided as the
* combination for toggling an ordered list.
*
* For the list of pre-configured Tiptap shortcuts, see
* https://tiptap.dev/api/keyboard-shortcuts.
*/
tooltipShortcutKeys?: MenuButtonTooltipProps["shortcutKeys"];
/**
* The icon component to use for the button, rendered as button `children` if
* provided. Must accept a className.
*/
IconComponent?: React.ElementType<{
className: string;
}>;
/**
* Override the default button content instead of displaying the
* <IconComponent />.
*/
children?: ReactNode;
/** Attaches a `ref` to the ToggleButton's root button element. */
buttonRef?: RefObject<HTMLButtonElement>;
/** Optional additional className to provide to the root element. */
className?: string;
/** Override or extend existing styles. */
classes?: Partial<MenuButtonClasses>;
/** Provide custom styles. */
sx?: SxProps;
};
export declare const MENU_BUTTON_FONT_SIZE_DEFAULT = "1.25rem";
/**
* A general-purpose base component for showing an editor control for use in a
* menu.
*/
export default function MenuButton(inProps: MenuButtonProps): import("react/jsx-runtime").JSX.Element;