CloseButton

Components/Actions

Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/closebutton

Overview

Copy

Close button is an interactive element that allows users to exit an event.

Do

  • Use it to close pages, notifications, helpers, cards or menus.
  • Use one close button at a time.

Don't

  • Don't use it to trigger any action other than close. Use <Button/> or <IconButton/> instead.

Feature examples

Size

Use size prop to choose the size of the close button:

  • Use large in larger size layouts, such as <SidePanel/> or modals.
  • Use medium in medium size layouts, such as <FloatingNotification/>.
  • Use small (default) for common use cases.
Copy

Skin

Use skin prop to control the appearance of the close button.

  • Use standard on white backgrounds.
  • Use standardFilled on white backgrounds when action needs to be emphasised.
  • Use transparent on colour or image backgrounds.
  • Use light on dark backgrounds.
  • Use dark on white or light color backgrounds.
Copy

Disabled

Use disabled prop to disable all close button interactions and to highlight unavailable functions.

Copy

Developer examples

Custom HTML tag

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.

Copy

Common use case examples

Marketing card

Allow users to dismiss a promotional marketing card by passing a close button as <Card/> controls.

Copy

Custom icon

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.

Copy

Code

Copy

Props

NameTypeDefaultDescription
as"button"—Renders component as any other component or a given HTML tag.
autoFocusboolean—Focus the button on mount.
childrenReactNode—Used for passing any
dataHookstring—Applies a data-hook HTML attribute that can be used in the tests.
disabledbooleanfalseSpecifies whether user interactions are disabled.
onClickMouseEventHandler—Defines a callback function which is called every time a button is clicked.
refnull | 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.

Testkit

Import the driver matching your test environment:

Copy

Driver methods

MethodDescription
isButtonDisabledChecks whether the button is disabled
getAriaLabelReturns the aria-label attribute of the button
existsChecks whether the component found with the given data hook.
elementGets the component root element.
clickClicks on the component root element.
baseReturns UniDriver for the base element.

Changelog

  • 1.340.0 (2026-10-21) — maintenance release, no component-specific changes
  • 1.339.0 (2026-10-19) — maintenance release, no component-specific changes
  • 1.338.0 (2026-10-15) — maintenance release, no component-specific changes
  • 1.331.0 (2026-10-01) — maintenance release, no component-specific changes
  • 1.330.0 (2026-09-28) — maintenance release, no component-specific changes
  • 1.325.0 (2026-09-17) — maintenance release, no component-specific changes
  • 1.323.0 (2026-09-10) — maintenance release, no component-specific changes
  • 1.315.0 (2026-08-20) — feat: supported by WixDesignSystemDefaultPropsProvider, so its props can be defaulted from the provider. (#16812)
  • 1.310.0 (2026-08-10) — maintenance release, no component-specific changes
  • 1.292.0 (2026-06-22) — maintenance release, no component-specific changes
  • 1.273.0 (2026-04-30) — maintenance release, no component-specific changes
  • 1.266.0 (2026-04-07) — maintenance release, no component-specific changes
  • 1.260.0 (2026-03-17) — maintenance release, no component-specific changes
  • 1.254.0 (2026-02-03) — maintenance release, no component-specific changes
  • 1.247.2 (2026-01-21) — maintenance release, no component-specific changes
  • 1.244.0 (2026-01-02) — maintenance release, no component-specific changes
  • 1.242.0 (2025-12-19) — maintenance release, no component-specific changes
  • 1.235.0 (2025-12-04) — maintenance release, no component-specific changes
  • 1.233.0 (2025-12-02) — maintenance release, no component-specific changes
  • 1.212.0 (2025-08-11) — maintenance release, no component-specific changes
  • 1.208.0 (2025-07-25) — breaking: editor3 tokenization + fixes according to Figma (#15114)
  • 1.180.0 (2025-04-14) — feat: change studio tokens colors for CloseButton (#14739)
  • 1.138.1 (2024-10-30) — maintenance release, no component-specific changes
  • 1.131.0 (2024-10-10) — maintenance release, no component-specific changes
  • 1.126.0 (2024-09-09) — maintenance release, no component-specific changes
  • 1.115.0 (2024-07-17) — maintenance release, no component-specific changes
  • 1.107.0 (2024-05-29) — maintenance release, no component-specific changes
  • 1.104.1 (2024-05-14) — maintenance release, no component-specific changes
  • 1.102.0 (2024-04-16) — maintenance release, no component-specific changes
  • 1.93.0 (2024-02-08) — maintenance release, no component-specific changes
  • 1.92.1 (2024-02-05) — maintenance release, no component-specific changes

Last updated: 22 October 2026

Did this help?