跳到主要内容

Button 按钮

常用的操作按钮,支持多种类型、尺寸、状态及国风主题色。

基础用法​

基础用法
import { LhButton } from '@lh-ui/react'

export default function Demo() {
return (
<>
<LhButton>默认按钮</LhButton>
<LhButton type="primary">主要按钮</LhButton>
<LhButton type="success">成功按钮</LhButton>
<LhButton type="warning">警告按钮</LhButton>
<LhButton type="danger">危险按钮</LhButton>
<LhButton type="info">信息按钮</LhButton>
</>
)
}

尺寸与状态​

尺寸与状态
import { LhButton } from '@lh-ui/react'

export default function Demo() {
return (
<>
<LhButton size="large">大型按钮</LhButton>
<LhButton>默认按钮</LhButton>
<LhButton size="small">小型按钮</LhButton>

<LhButton type="primary" loading>加载中</LhButton>
<LhButton type="primary" disabled>禁用态</LhButton>
<LhButton type="primary" icon="search">图标按钮</LhButton>
<LhButton type="primary" round>圆角按钮</LhButton>
<LhButton type="primary" plain>朴素按钮</LhButton>
</>
)
}

Button Props​

属性说明类型可选值默认值
type按钮类型'text' | 'primary' | 'success' | 'warning' | 'danger' | 'info'—'text'
size尺寸'large' | 'middle' | 'small'—跟随 ConfigProvider
loading加载中状态boolean—false
disabled禁用状态boolean—false
plain朴素形态boolean—false
block通栏(宽度 100%)boolean—false
round圆角boolean—false
circle圆形boolean—false
icon图标名LhIconName——
nativeType原生 type 属性'button' | 'submit' | 'reset'—'button'
href传入时渲染为 <a>string——
targethref 模式的 targetstring——
themeVars组件级主题变量Record<string, string>——
bgPattern组件级背景花纹string——
sx快速布局属性SxProps——

Button 事件​

事件说明回调签名Vue 对照
onClick点击时触发(disabled / loading 时不触发)(event: MouseEvent) => void@click

样式​

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