🔥 遇见我们的新项目 t0ggles - 你终极的项目管理工具! 🔥

按钮 Vue 组件

按钮组件

包含以下组件:

  • Button - 单个按钮

按钮属性

名称类型默认值描述
clearbooleanundefined

使按钮以清晰风格(无填充颜色)。覆盖 clearIosclearMaterial 属性

clearIosbooleanfalse

使按钮以清晰风格(无填充颜色)在 iOS 主题中

clearMaterialbooleanfalse

使按钮以清晰风格(无填充颜色)在 Material 主题中

colorsobject

包含 Tailwind CSS 颜色类对象的属性

colors.activeBgIosstring'active:bg-primary'
colors.activeBgMaterialstring''
colors.disabledBgstring'bg-black bg-opacity-10 dark:bg-white dark:bg-opacity-10'
colors.disabledBorderstring'border-black border-opacity-10 dark:border-white dark:border-opacity-10'
colors.disabledTextstring'text-black text-opacity-30 dark:text-white dark:text-opacity-30'
colors.fillActiveBgIosstring'active:bg-ios-primary-shade'
colors.fillActiveBgMaterialstring''
colors.fillBgIosstring'bg-primary'
colors.fillBgMaterialstring'bg-md-light-primary dark:bg-md-dark-primary'
colors.fillTextIosstring'text-white'
colors.fillTextMaterialstring'text-md-light-on-primary dark:text-md-dark-on-primary'
colors.fillTouchRipplestring'touch-ripple-white dark:touch-ripple-primary'
colors.outlineBorderIosstring'border-primary'
colors.outlineBorderMaterialstring'border-md-light-outline dark:border-md-dark-outline'
colors.textIosstring'text-primary'
colors.textMaterialstring'text-md-light-primary dark:text-md-dark-primary'
colors.tonalBgIosstring'bg-primary'
colors.tonalBgMaterialstring'bg-md-light-secondary-container dark:bg-md-dark-secondary-container'
colors.tonalTextIosstring'text-primary'
colors.tonalTextMaterialstring'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container'
colors.touchRipplestring'touch-ripple-primary'
componentstring'button'

组件的 HTML 元素

disabledbooleanfalse

使按钮失效

hrefstring

链接的 href 属性,如果指定,也将被渲染为 <a> 元素

inlinebooleanfalse

使按钮为内联(例如 display: inline-flex

largebooleanundefined

使按钮变大。覆盖 largeIoslargeMaterial 属性

largeIosbooleanfalse

使按钮在 iOS 主题中变大

largeMaterialbooleanfalse

使按钮在 Material 主题中变大

outlinebooleanundefined

使按钮为轮廓。覆盖 outlineIosoutlineMaterial 属性

outlineIosbooleanfalse

使按钮在 iOS 主题中为轮廓

outlineMaterialbooleanfalse

使按钮在 Material 主题中为轮廓

raisedbooleanundefined

使按钮凸起(带有阴影)。覆盖 raisedIosraisedMaterial 属性

raisedIosbooleanfalse

使按钮在 iOS 主题中凸起(带有阴影)

raisedMaterialbooleanfalse

使按钮在 Material 主题中凸起(带有阴影)

roundedbooleanundefined

使按钮变圆。覆盖 roundedIosroundedMaterial 属性

roundedIosbooleanfalse

使按钮在 iOS 主题中变圆

roundedMaterialbooleanfalse

使按钮在 Material 主题中变圆

segmentedbooleanfalse

渲染分段按钮,与 <SegmentedButton> 相同

segmentedActivebooleanfalse

渲染分段激活按钮,与 <SegmentedButton active> 相同

segmentedStrongbooleanfalse

渲染分段强按钮,与 <SegmentedButton strong> 相同

smallbooleanundefined

使按钮变小。覆盖 smallIossmallMaterial 属性

smallIosbooleanfalse

使按钮在 iOS 主题中变小

smallMaterialbooleanfalse

使按钮在 Material 主题中变小

tonalbooleanundefined

使按钮以色调风格(带有半透明填充颜色)。覆盖 tonalIostonalMaterial 属性

tonalIosbooleanfalse

使按钮以色调风格(带有半透明填充颜色)在 iOS 主题中

tonalMaterialbooleanfalse

使按钮以色调风格(带有半透明填充颜色)在 Material 主题中

touchRipplebooleantrue

在 Material 主题中启用触控波纹效果

示例

Buttons.vue
<template>
<k-page>
<k-navbar title="Buttons" />
<k-block-title>Default Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button>Button</k-button>
<k-button class="k-color-brand-red"> Button </k-button>
<k-button>Button</k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button outline>Outline</k-button>
<k-button class="k-color-brand-red" outline> Outline </k-button>
<k-button outline>Outline</k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button clear>Clear</k-button>
<k-button class="k-color-brand-red" clear> Clear </k-button>
<k-button clear>Clear</k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button tonal>Tonal</k-button>
<k-button class="k-color-brand-red" tonal> Tonal </k-button>
<k-button tonal>Tonal</k-button>
</div>
</k-block>
<k-block-title>Rounded Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button rounded>Button</k-button>
<k-button rounded class="k-color-brand-green">Button</k-button>
<k-button rounded>Button</k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button rounded outline> Outline </k-button>
<k-button rounded outline class="k-color-brand-green">
Outline
</k-button>
<k-button rounded outline> Outline </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button rounded clear> Clear </k-button>
<k-button rounded clear class="k-color-brand-green"> Clear </k-button>
<k-button rounded clear> Clear </k-button>
</div>
</k-block>
<k-block-title>Large Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button large>Button</k-button>
<k-button large class="k-color-brand-yellow">Button</k-button>
<k-button large rounded> Button </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button large outline> Outline </k-button>
<k-button large outline class="k-color-brand-yellow">
Outline
</k-button>
<k-button large rounded outline> Outline </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button large clear> Clear </k-button>
<k-button large clear class="k-color-brand-yellow"> Clear </k-button>
<k-button large rounded clear> Clear </k-button>
</div>
</k-block>
<k-block-title>Small Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button small>Button</k-button>
<k-button small>Button</k-button>
<k-button small rounded> Button </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button small outline> Outline </k-button>
<k-button small outline> Outline </k-button>
<k-button small rounded outline> Outline </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button small clear> Clear </k-button>
<k-button small clear> Clear </k-button>
<k-button small rounded clear> Clear </k-button>
</div>
</k-block>
<k-block-title>Raised Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button raised>Button</k-button>
<k-button raised>Button</k-button>
<k-button raised rounded> Button </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button raised outline> Outline </k-button>
<k-button raised outline> Outline </k-button>
<k-button raised rounded outline> Outline </k-button>
</div>
<div class="grid grid-cols-3 gap-x-4">
<k-button raised clear> Clear </k-button>
<k-button raised clear> Clear </k-button>
<k-button raised rounded clear> Clear </k-button>
</div>
</k-block>
<k-block-title>Disabled Buttons</k-block-title>
<k-block strong outline-ios class="space-y-2">
<div class="grid grid-cols-3 gap-x-4">
<k-button disabled>Button</k-button>
<k-button disabled outline>Outline</k-button>
<k-button disabled clear>Clear</k-button>
</div>
</k-block>
</k-page>
</template>
<script>
import {
kPage,
kNavbar,
kNavbarBackLink,
kButton,
kBlock,
kBlockTitle,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kButton,
kBlock,
kBlockTitle,
},
};
</script>
代码许可证: MIT.
2022 © Konsta UI by nolimits4web.