Kobalte.v0.12.5

Button

Enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.

Import

ts
import { Button } from "@kobalte/core";
ts
import { Button } from "@kobalte/core";

Features

  • Native HTML <button> element support.
  • <a> and custom element type support via the WAI ARIA Button design pattern.
  • Keyboard event support for Space and Enter keys.

Anatomy

The button consists of:

  • Button.Root: The root container for a button.
tsx
<Button.Root />
tsx
<Button.Root />

Example

API Reference

Button.Root

PropDescription
disabledboolean
Whether the button is disabled.
Data attributeDescription
data-disabledPresent when the button is disabled.

Rendered elements

ComponentDefault rendered element
Button.Rootbutton

Accessibility

Keyboard Interactions

KeyDescription
SpaceActivates the button.
EnterActivates the button.