CloseButton

ActionIcon with close icon

Import

Usage

CloseButton renders a button with X icon inside. It is used in other Mantine components like Drawer or Modal.

Size
Variant
import { CloseButton } from '@mantine/core';

function Demo() {
  return <CloseButton />;
}

Accessibility

To make CloseButton accessible for screen readers, you need to either set aria-label or use VisuallyHidden component:

import { CloseButton, VisuallyHidden } from '@mantine/core';

function Demo() {
  return (
    <>
      <CloseButton aria-label="Close modal" />

      <CloseButton>
        <VisuallyHidden>Close modal</VisuallyHidden>
      </CloseButton>
    </>
  );
}