Skip to content

Button ​

Displays a button or a component that looks like a button.

Variants ​

Approximate web preview — the HarmonyOS rendering is the reference.

Sizes ​

Approximate web preview — the HarmonyOS rendering is the reference.

Icons & states ​

Approximate web preview — the HarmonyOS rendering is the reference.

Block & loading text ​

block stretches to the parent width; loadingText replaces the label while loading.

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SButton ​

shadcn-vue Button.

Clicks use the native universal event (.onClick() on SButton itself, like Vue's @click); while disabled / loading an inner no-op tap gesture swallows the tap (see SparkTapBlocker).

PropTypeDefaultDescription
textResourceStr | undefinedundefined
variantButtonVariant
ButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
'default'
sizingButtonSize
ButtonSize = 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg'
'default'
disabledbooleanfalse
loadingbooleanfalseShows a spinner and disables the button.
loadingTextResourceStr | undefinedundefinedText shown instead of text while loading.
blockbooleanfalseFull width of the parent (w-full).
iconstring | undefinedundefinedLeading lucide icon name.
iconRightstring | undefinedundefinedTrailing lucide icon name.
labelstring | undefinedundefinedAccessible name; required for icon-only buttons.
modifierAttributeModifier<ButtonAttribute>new SparkNoopModifier<ButtonAttribute>()Extra styles applied after the variant recipe (wins on conflicts).
tokensButtonTokens{}Per-instance token overrides (instance → theme --button-* → recipe), e.g. tokens: { radius: 999, background: 'oklch(0.6 0.2 250)' }. See ADR D13.
pressFeedbackSparkPressFeedback
SparkPressFeedback = 'background' | 'opacity' | 'none'
'background'Press feedback: 'background' (actions, default), 'opacity' (selection items), 'none'.

Slots: children (trailing closure)

MIT Licensed