Skip to content

Button

The ZButton component is used for triggering actions. It supports multiple variants, sizes, loading states, and can render as different elements.

Import

tsx
import { ZButton } from "@zurto/ui";

Basic Usage

ZButton

Variants

ZButton comes with 5 built-in variants to match different use cases.

ZButton

Sizes

Three sizes are available: sm, md (default), and lg.

ZButton

Loading State

Show a loading spinner while an action is in progress.

ZButton

Disabled State

Disable interaction with the button.

ZButton

With Icons

Add icons before or after the button text using leftIcon and rightIcon props.

ZButton

Icon Only

Create icon-only buttons with proper accessibility.

ZButton

Full Width

Make the button take the full width of its container.

ZButton

Render the button as an anchor element while keeping button styles.

ZButton

Button Group

Combine multiple buttons in a group.

ZButtonGroupZButton

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'danger' | 'outline''primary'Visual style of the button
size'sm' | 'md' | 'lg''md'Size of the button
loadingbooleanfalseShow loading spinner and disable interaction
disabledbooleanfalseDisable the button
leftIconReactNodeIcon to display before the button text
rightIconReactNodeIcon to display after the button text
fullWidthbooleanfalseMake button take full container width
asElementType'button'Render as a different element (e.g., anchor)
childrenRequiredReactNodeButton content

Accessibility

  • Uses native <button> element with proper semantics
  • aria-disabled is applied when disabled
  • aria-busy is applied when loading
  • Focus ring visible for keyboard navigation
  • Use aria-label for icon-only buttons

Keyboard Support

KeyAction
EnterActivates the button
SpaceActivates the button
TabMoves focus to/from the button

Released under the MIT License.