CloseButtonpolymorphic

ActionIcon with close icon
Import

Usage

CloseButton is a premade ActionIcon with close icon. Component accepts the same props as ActionIcon with additional iconSize prop to control icon width and height:

import { CloseButton, Group } from '@mantine/core';
function Demo() {
return (
<Group position="center">
<CloseButton aria-label="Close modal" />
<CloseButton title="Close popover" size="xl" iconSize={20} />
</Group>
);
}

Accessibility

CloseButton does not have an associated label, set title or aria-label props to make it visible for screen readers:

<CloseButton /> // -> not visible to screen reader
<CloseButton title="Settings" /> // -> ok
<CloseButton aria-label="Settings" /> // -> ok
Download more icon variants from https://tabler-icons.io/i/search

CloseButton component props

NameTypeDescription
color
MantineColor
Key of theme.colors
disabled
boolean
Indicates disabled state
gradient
MantineGradient
Controls gradient settings in gradient variant only
iconSize
number
Width and height of cross icon
loaderProps
LoaderProps
Props spread to Loader component
loading
boolean
Indicates loading state
radius
number | "xs" | "sm" | "md" | "lg" | "xl"
Button border-radius from theme or number to set border-radius in px
size
number | "xs" | "sm" | "md" | "lg" | "xl"
Predefined icon size or number to set width and height in px
variant
"outline" | "transparent" | "light" | "default" | "filled" | "subtle" | "gradient"
Controls appearance