Skip to content

Button ​

Basic button component. It is rendered by the uni built-in <button> (compiled to the native button on each target), and the click event is compiled by uni into bindtap.

Basic usage ​

vue
<template>
  <lh-button>Default</lh-button>
  <lh-button type="primary">Primary</lh-button>
  <lh-button type="success">Success</lh-button>
  <lh-button type="warning">Warning</lh-button>
  <lh-button type="danger">Danger</lh-button>
  <lh-button type="info">Info</lh-button>
</template>

States and shapes ​

vue
<template>
  <lh-button loading>Loading</lh-button>
  <lh-button disabled>Disabled</lh-button>
  <lh-button plain>Plain</lh-button>
  <lh-button round>Round</lh-button>
  <lh-button circle icon="search" />
  <lh-button block>Block (fills the row)</lh-button>
  <lh-button icon="search" type="primary">With icon</lh-button>
</template>

Props ​

PropDescriptionTypeDefault
typeType'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info''default'
sizeSize; inherited from ConfigProvider when not passed'small' | 'medium' | 'large'—
loadingLoading statebooleanfalse
disabledDisabledbooleanfalse
plainPlain (outlined) stylebooleanfalse
blockBlock layoutbooleanfalse
roundRounded cornersbooleanfalse
circleCircularbooleanfalse
iconIcon nameLhIconName—
customClassCustom class name (passed through to the root node)string—
themeVarsComponent-level theme variablesRecord<string, string>—
bgPatternComponent-level background patternstring—
sxQuick layout propsLhSxProps—

Events ​

EventDescriptionCallback parameters
clickClick(event)

Differences from the Vue3 version

The Mini Program button has no nativeType / href / target semantics, so these three props are not implemented in this library. The rest of the API is identical.