Button
按钮会触发一个事件或动作,它让用户知道接下来会发生什么。
使用
ts
import { NxButton, NxButtonGroup } from "@pc-nexus/angular";ts
import { NxButton, NxButtonGroup } from "@pc-nexus/react";属性
Button
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
color | 'default' | 'primary' | 'info' | 'warning' | 'danger' | 'success' | 按钮颜色,默认 default | |
appearance | 'fill' | 'outline' | 'link' | 按钮外观,默认 fill | |
type | 'button' | 'submit' | 'reset' | 原生 button type,默认 button | |
name | string | 原生 name | |
autofocus | boolean | 原生 autofocus,默认 false | |
tabindex | number | 原生 tabindex | |
size | 'small' | 'medium' | 'large' | 按钮大小,默认 medium | |
icon | string | 按钮图标,仅支持内置图标库中的名称 | |
block | boolean | 按钮是否占满父容器宽度,默认 false | |
disabled | boolean | 按钮禁用,默认 false |
ButtonGroup
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
appearance | 'outline' | 'fill' | 按钮组外观,默认 outline | |
size | 'small' | 'medium' | 'large' | 按钮组大小 |
示例
Default
按钮的默认外观和大小,参数使用默认值。
Color
通过 color 设置按钮颜色,取值可以为 'default' | 'primary' | 'info' | 'warning' | 'danger' | 'success'。
Appearance
通过 appearance 设置按钮外观,取值可以为 'fill' | 'outline' | 'link'。常与 color 组合使用。
Size
通过 size 设置按钮大小,取值可以为 'small' | 'medium' | 'large'。
Disabled
通过 disabled 设置按钮的禁用状态。
Icon
通过 icon 为按钮添加图标,可与文字组合,也可单独作为图标按钮。
Block
通过 block 让按钮占满父容器宽度。
Button Group
按钮组,用于将多个按钮组合在一起。
Button Group Appearance
通过 appearance 设置按钮组外观,取值可以为 'outline' | 'fill'。
Button Group Size
通过 size 设置按钮组大小,取值可以为 'small' | 'medium' | 'large'。
Button Group Icon
按钮组中的按钮可通过 icon 添加图标。