Typix LogoTypix
Editor Toolbar

HeadingButton

Toggle heading levels H1–H6 in the editor.

Install

npx typix ui add heading-button

Import

import { HeadingButton } from "@/components/typix/main/heading-button";

Props

PropTypeDefaultDescription
level1 | 2 | 3 | 4 | 5 | 6Heading level. Required.
textstringOverride the button label.
hideWhenUnavailablebooleanfalseHide when heading can't be applied.
showShortcutbooleantrueShow keyboard shortcut in tooltip.
onToggled(isActive: boolean) => voidCalled after the heading is toggled.
classNamestringAdditional CSS classes.

Hook

import { useHeading } from "@/components/typix/main/heading-button";

function MyH1Button() {
  const { isActive, handleToggle, label } = useHeading({ level: 1 });
  return <button onClick={handleToggle} aria-pressed={isActive}>{label}</button>;
}

On this page