Button

An action or link with size, color, theme and loading state.

Use onClick for an action and href for navigation. loading shows progress; disabled blocks interaction — a disabled link does not call onClick either. An icon-only button is square; give it an aria-label or wrap it in a Tooltip.

Live example

Example controls

Usage

import { Button } from '@prosazhin/pbcomponents';

<Button
  size='m'
  theme='filled'
  color='primary'
>
  Button
</Button>;

Component API

PropType / variantsPurposeDefault
childrenstringComponent content.—
size'xs' | 's' | 'm' | 'l'xs · s · m · lComponent size.m
theme'filled' | 'light' | 'border' | 'ghost'filled · light · border · ghostButton appearance.filled
color'primary' | 'secondary' | 'success' | 'danger'primary · secondary · success · dangerSemantic color.primary
disabledbooleanDisables interaction.false
loadingbooleanShows a pending action.false
leftIconSvgTypenone · check · search · userIcon before the text; accepts an SVG component.—
rightIconSvgTypenone · check · search · userIcon after the text; accepts an SVG component.—
leftIconClassNamestringClass of the left icon.—
rightIconClassNamestringClass of the right icon.—
onClick(event) => voidClick handler.—
hrefstringRenders a link instead of a button.—
linkComponentElementTypeCustom link component, such as Next.js Link.—
target'_self' | '_blank'_self · _blankWhere to open the link._self
type'button' | 'reset' | 'submit'button · reset · submitHTML button type.button
classNamestringClass of the root element.—
textClassNamestringClass of the text part.—

Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.