Skip to content

useClickableContainer

@astryxdesign/core v0.7.1 · useClickableContainer

Parameters ​

NameTypeDefaultDescription
optionsUseClickableContainerOptions—Configuration object for the clickable container. Required.
options.containerRefRef<HTMLElement | null>—Ref to the outer container element. Required.
options.interactiveRefRef<HTMLElement | null>—Ref to the primary interactive element inside (link, button). If no onClick or href is provided, clicks are proxied to this element.
options.onClick(event: MouseEvent) => void—Click handler fired when the container surface (not a nested interactive element) is clicked.
options.hrefstring—Navigation URL. When provided, clicking the container navigates to this URL.
options.targetstring—Link target (for example '_blank'). Used with href for navigation behavior.
options.disabledbooleanfalseWhether the container is disabled.

Returns ​

NameTypeDescription
onClick(event: MouseEvent) => voidClick handler to attach to the container element.
onMouseUp(event: MouseEvent) => voidMouse up handler to attach to the container (handles middle-click navigation for href).