bloxa

Button

FREE

Button with variants, sizes, start/end icons, loading state and ButtonGroup. Supports asChild.

Playground

Change the props and watch the component and its code update live.

Props
Code
import { Rocket } from "lucide-react";
import { Button } from "@/components/ui/button";

<Button
  startIcon={<Rocket />}
>
  Deploy
</Button>

Installation

Terminal
npx @bloxa/cli add button
# or: npx shadcn@latest add @bloxa/button

Install separately: hold-button

Terminal
npx shadcn@latest add @bloxa/hold-button

Packages installed automatically: radix-ui, class-variance-authority

Examples

Variants

Five visual styles; use primary for the main action.

Sizes

Icons

startIcon / endIcon, or icon only. Give icon-only buttons an aria-label.

Loading

Width stays fixed and the button is disabled. Click the first button to try it.

Button group

Split button

Main action plus a dropdown; menus can have submenus.

Hold to confirm

For risky actions. Releasing early cancels.

Press and hold for 1.2 seconds.

Use asChild to apply button styles to an <a> tag.

API reference

Every component also accepts the props of the element it renders.

Button

PropTypeDefaultDescription
variant"primary" | "secondary" | "outline" | "ghost" | "destructive""primary"Visual style.
size"sm" | "md" | "lg" | "icon" | "icon-sm""md"Size; icon sizes are square.
startIconReactNode—Icon before the label.
endIconReactNode—Icon after the label.
loadingbooleanfalseShows a spinner, keeps the width and disables the button.
asChildbooleanfalseApplies the styles to the child element (e.g. <a>).

ButtonGroup

Joins buttons into one segment.

HoldButton

Installed separately with @bloxa/hold-button.

PropTypeDefaultDescription
onConfirm() => void—Runs when the hold completes.
durationnumber1200Hold duration in milliseconds.
variantButtonProps["variant"]"destructive"Button style.
sizeButtonProps["size"]"md"Button size.