Typix LogoTypix
Editor Toolbar

UndoRedoButton

Undo or redo the last editor change.

Install

npx typix ui add undo-redo-button

Import

import { UndoRedoButton } from "@/components/typix/main/undo-redo-button";

Props

PropTypeDefaultDescription
action"undo" | "redo"Which action to perform. Required.
textstringOverride the button label.
hideWhenUnavailablebooleanfalseHides when undo/redo history is empty.
showShortcutbooleantrueShow keyboard shortcut in tooltip.
classNamestringAdditional CSS classes.

Hook

import { useUndoRedo } from "@/components/typix/main/undo-redo-button";

const { canUndo, canRedo, handleUndo, handleRedo } = useUndoRedo({ action: "undo" });

On this page