Components/Actions
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/closebutton
Close button is an interactive element that allows users to exit an event.
<Button/> or <IconButton/> instead.Use size prop to choose the size of the close button:
large in larger size layouts, such as <SidePanel/> or modals.medium in medium size layouts, such as <FloatingNotification/>.small (default) for common use cases.Use skin prop to control the appearance of the close button.
standard on white backgrounds.standardFilled on white backgrounds when action needs to be emphasised.transparent on colour or image backgrounds.light on dark backgrounds.dark on white or light color backgrounds.Use disabled prop to disable all close button interactions and to highlight unavailable functions.
Use as prop to render close button as any given HTML tag.
For example, they can be rendered as:
<a> when attributes like href, target, etc., are needed.<Link> when props like to, replace, etc. are needed.All attributes will be passed to the rendered HTML tag.
Allow users to dismiss a promotional marketing card by passing a close button as <Card/> controls.
To add a help icon next to the close button, pass the help icon as a child element to <CloseButton/>.
This is valid only when the help icon is next to the close button. For all other cases use <IconButton/> instead.
While it is possible to override the x icon with any other icon, it is not recommended to ensure the component's consistency.
| Name | Type | Default | Description |
|---|---|---|---|
as | "button" | — | Renders component as any other component or a given HTML tag. |
autoFocus | boolean | — | Focus the button on mount. |
children | ReactNode | — | Used for passing any |
dataHook | string | — | Applies a data-hook HTML attribute that can be used in the tests. |
disabled | boolean | false | Specifies whether user interactions are disabled. |
onClick | MouseEventHandler | — | Defines a callback function which is called every time a button is clicked. |
ref | null | string | (instance: HTMLButtonElement | null) => void | RefObject<HTMLButtonElement> | — | Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). |
size | "small" | "medium" | "large" | 'small' | Controls the size of the button and its icon. |
skin | "standard" | "light" | "dark" | "transparent" | "standardFilled" | "lightFilled" | 'standard' | Controls the skin of the button. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
isButtonDisabled | Checks whether the button is disabled |
getAriaLabel | Returns the aria-label attribute of the button |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
WixDesignSystemDefaultPropsProvider, so its props can be defaulted from the provider. (#16812)Last updated: 22 October 2026