Skip to content

Button 按钮

常用的操作按钮。

基础用法

使用 typeplainroundcircle 来定义按钮的样式。

<script setup>
import { CbButton as Button } from '@ptpchips/carbon-ui'
</script>
<template>
  <div class="button-box">
    <Button> hello </Button>
    <Button loading> Loading </Button>
  </div>
  <div class="button-box">
    <Button type="primary"> Primary </Button>
    <Button type="success"> Success </Button>
    <Button type="warning"> Warning </Button>
    <Button type="danger"> Danger </Button>
    <Button type="info"> Info </Button>
  </div>
  <div class="button-box">
    <Button plain type="primary"> Primary </Button>
    <Button plain type="success"> Success </Button>
    <Button plain type="warning"> Warning </Button>
    <Button plain type="danger"> Danger </Button>
    <Button plain type="info"> Info </Button>
  </div>
</template>

<style scoped>
.button-box:not(:last-child) {
  margin-bottom: 12px;
}
</style>

Button Attributes

NameDescriptionTypeDefault
sizebutton sizeenum - 'large'| 'small'
typebutton typeenum - 'primary'| 'success'| 'warning'| 'danger'| 'info'
plaindetermine whether it's a plain buttonbooleanfalse
rounddetermine whether it's a round buttonbooleanfalse
circledetermine whether it's a circle buttonbooleanfalse
loadingdetermine whether it's loadingbooleanfalse
disableddisable the buttonbooleanfalse
iconicon componentstring
autofocussame as native button's autofocusbooleanfalse
native-typesame as native button's typeenum - 'button'| 'submit'| 'reset'button