bit Bheadless

CloseButton

A utility button pre-wired to close the nearest enclosing Dialog, Popover, or Disclosure — saves boilerplate for dismiss actions.

Implementation: CSS Tailwind

Inside a Dialog

Drop <BitBhCloseButton> anywhere inside a Dialog and it will automatically call the dialog's close callback. No need to wire up @onclick or pass state around.

Inside a Popover

Use BitBhCloseButton inside a popover panel to close it on click. Combine with the As parameter to render as an anchor or any other element.

Inside a Disclosure

Works the same way inside a Disclosure. The button finds the nearest closeable ancestor and calls its close method.

Here are some details you can collapse.

Polymorphic rendering (As)

Use the As parameter to render the close button as any HTML element. Non-native button elements automatically receive role="button", tabindex="0", and Enter/Space keyboard handling.

Disabled state

Set Disabled="true" to prevent the close action. The button receives the native disabled attribute (or aria-disabled for non-native elements) and a data-disabled styling hook.

An unhandled error has occurred. Reload 🗙