Button
Server ComponentClickable action with variants, sizes and asChild.
Import
tsx
import { Button } from "@cronus-ui/ui";
bash
npx cronus-ui add button
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
as-link.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component ButtonAsLink layout:inline style:button+link+md {
label "Docs" -> "/docs"
}
page "/audit/button/as-link" type:custom {
use ButtonAsLink
}
disabled.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component ButtonDisabled layout:inline style:button+primary+md {
disabled:true
label "Save profile"
}
page "/audit/button/disabled" type:custom {
use ButtonDisabled
}
primary-md.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component ButtonPrimaryMd layout:inline style:button+primary+md {
label "Save profile"
}
page "/audit/button/primary-md" type:custom {
use ButtonPrimaryMd
}
API Reference
Generated from the component's exported types.
ButtonProps
Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Render as the child element via Slot. |
variant | "primary" | "secondary" | "outline" | "ghost" | "destructive" | "link" | "primary" | One of "primary" | "secondary" | "outline" | "ghost" | "destructive" | "link". |
size | "sm" | "md" | "lg" | "icon" | "icon-sm" | "md" | One of "sm" | "md" | "lg" | "icon" | "icon-sm". |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
type | string | — | Native type of the underlying element. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
onClick | (event: MouseEvent) => void | — | Click handler. |