Diwa Design System

Button

Buttons trigger actions, submit forms, and navigate through the application. Choose the variant that communicates the weight of the action.

Properties

NameTypeDefaultDescription
theme'light' | 'dark''dark'Per-component theme override. Overrides the global theme for this button instance.
variant'primary' | 'secondary' | 'ghost' | 'danger''primary'Visual style variant of the button.
size'sm' | 'md' | 'lg''md'Size tier. Controls height, padding, and font size.
type'button' | 'submit' | 'reset''button'Native button type. Relevant when the button is inside a <form>.
disabledbooleanfalsePuts the button in a disabled state. Blocks interaction and lowers opacity.
loadingbooleanfalseReplaces button content with a spinner and sets aria-busy. Blocks interaction.
hrefstringWhen provided, the button renders as an <a> anchor element instead of <button>.
target'_blank' | '_self' | '_parent' | '_top'Link target. Only applicable when href is set.
namestringNative name attribute for form submission. Only relevant for button type.
valuestringNative value attribute for form submission. Only relevant for button type.
labelstringAccessible label. Use for icon-only buttons to provide a screen-reader-accessible name.
hideLabelbooleanfalseHides the slotted label visually. Used together with label to create icon-only buttons.

Events

NameDetail typeBubblesDescription
clickMouseEventYesNative DOM click event. Suppressed (preventDefault + stopPropagation) when disabled or loading. Use onClick (React), @click (Vue), or (click) (Angular).

Slots

NameDescription
(default)Button label text. Accepts plain text, icons, or mixed inline content.
icon-startIcon placed before the label. Use with a 16 × 16 px SVG icon component.

CSS custom properties

Override these tokens on the host element or a parent selector to customise the button's appearance without modifying source styles.

PropertyFallbackDescription
--diwa-button-bg--diwa-accentBackground colour.
--diwa-button-bg-hover--diwa-accent-hoverBackground colour on hover.
--diwa-button-color--diwa-text-inverseForeground (text and icon) colour.
--diwa-button-radius--diwa-radius-mdBorder radius.
--diwa-button-height40pxHeight for the md size.
--diwa-button-height-sm32pxHeight for the sm size.
--diwa-button-height-lg44pxHeight for the lg size.
--diwa-button-padding-x16pxHorizontal padding for md and lg sizes.
--diwa-button-padding-x-sm10pxHorizontal padding for the sm size.
--diwa-button-font-size--diwa-font-size-baseFont size.
--diwa-button-font-weight--diwa-font-weight-mediumFont weight.