Skip to content

Button

This component is internally implemented based on the uni-app button component with secondary encapsulation. The main differences are:

  • Added the type attribute to set the button type.
  • Added the size attribute to set the button size.
  • Added the is-ripple attribute to set the ripple effect when clicked.

Notice

The button's open capabilities remain consistent with the uni-app button component; no new features are added in that regard. Please refer to the uni-app Button Component.

Platform Differences

App (vue)App (nvue)H5Mini Program

Basic Usage

  • Set the button text via title.
html
<see-button title="Default Button" />

Button Types

  • Set the button theme via the type parameter, defaulting to info.
html
<see-button title="Default Button" />
<see-button title="Primary Button" type="primary" />
<see-button title="Error Button" type="error" />
<see-button title="Warning Button" type="warning" />
<see-button title="Success Button" type="success" />

Hollow Buttons

  • By setting isHollow to true, the background color becomes transparent while the border and text retain the theme color. Defaults to false.
html
<see-button isHollow title="Default Button" />
<see-button isHollow title="Primary Button" type="primary" />
<see-button isHollow title="Error Button" type="error" />
<see-button isHollow title="Warning Button" type="warning" />
<see-button isHollow title="Success Button" type="success" />

Disabled Buttons

  • Set the button to a disabled state by setting the isDisabled parameter to true.
  • In the disabled state, click events will not trigger, and the style will turn gray or reduce in transparency.
html
<see-button isDisabled title="Default Button" />
<see-button isDisabled title="Primary Button" type="primary" />
<see-button isDisabled title="Error Button" type="error" />
<see-button isDisabled title="Warning Button" type="warning" />
<see-button isDisabled title="Success Button" type="success" />

Button Sizes

  • Set the button size via the size parameter. We provide four attributes: default, small, mini, large.
html
<see-button size="default" title="Default Size" />
<see-button size="small" title="Small Size" />
<see-button size="mini" title="Mini Size" />
<see-button size="large" title="Large Size" />

Ripple Animation

  • When the isRipple attribute is enabled, clicking the button will produce a ripple effect spreading from the contact point.
  • ripple-color: Custom ripple color.
  • ripple-time: Ripple diffusion speed (milliseconds).
html
<see-button title="Default Animation" isRipple />
<see-button type="primary" size="default" title="Button Color" isRipple />
<see-button size="default" title="Animation Color" isRipple ripple-color="blue" />
<see-button
  size="large"
  title="Animation Duration (10000ms)"
  isRipple
  ripple-time="10000"
  ripple-color="red"
  mask-time="20000"
/>

Customization

vue
<see-button :customStyle="customStyle" title="Custom Width/Height" />
<see-button :radius="24" title="Rounded Button" />
<see-button
  size="large"
  title="Gradient Button"
  textColor="#FFFFFF"
  color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"
  isRipple
/>
<see-button title="Custom Color" color="#8A4D35" textColor="#FFFFFF" isRipple />
<see-button title="Passing a view">
  <view style="width: 10px; height: 10px; border: 1px red solid" />
</see-button>
<see-button size="large">
  <text>Title as a slot</text>
</see-button>

<script lang="ts" setup>
const customStyle = {
  width: "200px",
  height: "150px",
};
</script>
vue
<see-button :customStyle="customStyle" title="Custom Width/Height" />
<see-button :radius="24" title="Rounded Button" />
<see-button
  size="large"
  title="Gradient Button"
  textColor="#FFFFFF"
  color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"
  isRipple
/>
<see-button title="Custom Color" color="#8A4D35" textColor="#FFFFFF" isRipple />
<see-button title="Passing a view">
  <view style="width: 10px; height: 10px; border: 1px red solid" />
</see-button>
<see-button size="large">
  <text>Title as a slot</text>
</see-button>

<script>
export default {
  data() {
    return {
      customStyle: {
        width: "200px",
        height: "150px",
      },
    };
  },
};
</script>

API

Props

ParameterDescriptionTypeDefaultOptional ValuesPlatform Notes
titleButton text contentString''Any string-
sizeButton size`"default""large""small""mini"`
typeButton type (preset styles)`"info""primary""error""warning"
colorCustom background color (overrides default type color)String''Any CSS color value-
textColorText colorString''Any CSS color value-
isRippleWhether to enable the ripple click effectBooleanfalsetrue, false-
rippleTimeRipple diffusion animation duration (ms)Number500Any number (suggested 300–800)-
maskTimeRipple mask fade-out duration (ms)Number1000Any number (suggested 2x rippleTime)-
rippleColorColor of the generated rippleString'rgba(0,0,0,.15)'Any CSS color value-
rippleStyleCustom style for the ripple (e.g., opacity, animation type)String''Any string-
customStyleCustom button style (overrides outer view + inner button)String''Any string-
hoverClassHover style when clicked (valid for H5 & Mini Programs)String / Null''Custom class name-
borderBorder toggle (simulates border using box-shadow)`10`11 (with border), 0 (no border)
isDisabledWhether the button is disabledBooleanfalsetrue, false-
radiusButton corner radius (px)Number4Any number-
isHollowWhether the button is a hollow button (inverted colors)Booleanfalsetrue, false-

Events

AttributeDescriptionTypeDefaultOptionalPlatform Notes
clickTriggered when the button is clickedNone---

Liao ICP No. 2025070134