Skip to Content
Actions & Basics@hacline/ui/button

Button

Button component built on @ui-sdk/react/button with native async double-submit prevention, accessible focus management, and polymorphic link rendering.

Import

import { Button } from "@/components/ui/hacline/components/button";

Variants

Switch the visual hierarchy of the button with variant. Defaults to primary.

Sizes

Adjust the button size using size, supporting sm, md, lg, and icon sizes icon-sm, icon, and icon-lg. Always provide an aria-label when rendering an icon-only button.

Async Loading State

When onClick returns a Promise, the button automatically enters the data-pending state, retains focus, blocks duplicate clicks, and announces pendingAnnouncement to screen readers if the operation exceeds 1 second. Use data-show="idle" and data-show="pending" to swap icons or content automatically.

Saved 0 times

Disabled and Focusable State

Setting disabled blocks activation and removes the button from the Tab order. Combine with focusableWhenDisabled to use aria-disabled and keep keyboard focusability, making it easy to pair with helper text or a Tooltip explaining why the action is unavailable.

Use the render prop to render the button as an <a> or router link component (such as Next.js Link), preserving link semantics and disabled interception behavior.

Props

Prop

Type

Also inherits all native <button> HTML attributes and ref.

Data Attributes

The component exposes the following state attributes for custom styling and animations:

AttributeDescription
data-slot="button"Identifies the button root element
data-pendingPresent while the Promise returned by onClick is pending
data-disabledPresent when the button is disabled
data-show="idle" | "pending"Placed on child elements to toggle visibility automatically with data-pending