Skip to Content
FrontendBundlesComponentsUI PrimitivesButton

Button

The core button component. Built with Radix UI Slot and class-variance-authority for consistent variant/size management.


Import

import { Button } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Button";

Props

PropTypeRequiredDefaultDescription
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "blue" | "green" | "transparent" | "grey" | "edit" | "add" | "delete""default"Visual style variant
size"default" | "sm" | "lg" | "icon""default"Size preset
isLoadingbooleanfalseShows spinner and disables the button
onlyIconbooleanfalseIcon-only mode (no label)
iconStartReactNodeIcon rendered before the label
iconEndReactNodeIcon rendered after the label
asChildbooleanfalseRenders as child element via Radix Slot (e.g. wrap a <Link>)
parentClassNamestringClass on the wrapper div
loaderStylingClassstringClass applied to the spinner

Plus all standard HTML <button> attributes.


Usage

<Button variant="default">Save</Button> <Button variant="destructive">Delete</Button> <Button variant="outline">Cancel</Button> <Button variant="secondary">Secondary</Button> <Button variant="ghost">Ghost</Button> <Button variant="add">Add Item</Button> <Button variant="edit">Edit</Button> <Button variant="delete">Remove</Button>

Last updated on