Skip to main content

Button

A common action button, supporting multiple types, sizes, states, and Chinese-style theme colors.

Basic usage​

Basic usage
import { LhButton } from '@lh-ui/react'

export default function Demo() {
return (
<>
<LhButton>Default</LhButton>
<LhButton type="primary">Primary</LhButton>
<LhButton type="success">Success</LhButton>
<LhButton type="warning">Warning</LhButton>
<LhButton type="danger">Danger</LhButton>
<LhButton type="info">Info</LhButton>
</>
)
}

Sizes and states​

Sizes and states
import { LhButton } from '@lh-ui/react'

export default function Demo() {
return (
<>
<LhButton size="large">Large</LhButton>
<LhButton>Default</LhButton>
<LhButton size="small">Small</LhButton>

<LhButton type="primary" loading>Loading</LhButton>
<LhButton type="primary" disabled>Disabled</LhButton>
<LhButton type="primary" icon="search">Icon</LhButton>
<LhButton type="primary" round>Rounded</LhButton>
<LhButton type="primary" plain>Plain</LhButton>
</>
)
}

Button Props​

PropDescriptionTypeOptionsDefault
typeButton type'text' | 'primary' | 'success' | 'warning' | 'danger' | 'info'—'text'
sizeSize'large' | 'middle' | 'small'—From ConfigProvider
loadingLoading stateboolean—false
disabledDisabled stateboolean—false
plainPlain styleboolean—false
blockBlock (width 100%)boolean—false
roundRounded cornersboolean—false
circleCircleboolean—false
iconIcon nameLhIconName——
nativeTypeNative type attribute'button' | 'submit' | 'reset'—'button'
hrefRenders as <a> when providedstring——
targettarget for href modestring——
themeVarsComponent-level theme variablesRecord<string, string>——
bgPatternComponent-level background patternstring——
sxLayout shorthandSxProps——

Button events​

EventDescriptionCallback signatureVue equivalent
onClickFired on click (not fired when disabled / loading)(event: MouseEvent) => void@click

Styles​

import '@lh-ui/react/style/button'