Skip to content

Button

Common Buttons

Basic Usage

Use typeplainrounddashed and circle to change button style.

vue
<template>
  <div>
    <re-button>Default</re-button>
    <re-button type="primary">Primary</re-button>
    <re-button type="success">Success</re-button>
    <re-button type="warning">Warning</re-button>
    <re-button type="danger">Danger</re-button>
    <re-button type="info">Info</re-button>
  </div>
  <div class="pt-1em">
    <re-button plain>Plain</re-button>
    <re-button type="primary" plain>Primary</re-button>
    <re-button type="success" plain>Success</re-button>
    <re-button type="warning" plain>Warning</re-button>
    <re-button type="danger" plain>Danger</re-button>
    <re-button type="info" plain>Info</re-button>
  </div>
  <div class="pt-1em">
    <re-button round>Round</re-button>
    <re-button type="primary" round>Primary</re-button>
    <re-button type="success" round>Success</re-button>
    <re-button type="warning" round>Warning</re-button>
    <re-button type="danger" round>Danger</re-button>
    <re-button type="info" round>Info</re-button>
  </div>

  <div class="pt-1em">
    <re-button dashed>Dashed</re-button>
    <re-button type="primary" dashed>Primary</re-button>
    <re-button type="success" dashed>Success</re-button>
    <re-button type="warning" dashed>Warning</re-button>
    <re-button type="danger" dashed>Danger</re-button>
    <re-button type="info" dashed>Info</re-button>
  </div>
  <div class="pt-1em">
    <re-button circle icon="search" />
    <re-button circle icon="search-bold" type="primary" />
    <re-button circle icon="arrow-right" type="success" />
    <re-button circle icon="arrow-up" type="warning" />
    <re-button circle icon="delete" type="danger" />
    <re-button circle icon="close-short" type="info" />
    <re-button circle icon="star" type="warning" dashed />
  </div>
</template>

Disabled Button

Use disabled attribute to disable a button. It accepts a Boolean value.

vue
<template>
  <div>
    <re-button disabled>Default</re-button>
    <re-button type="primary" disabled>Primary</re-button>
    <re-button type="success" disabled>Success</re-button>
    <re-button type="warning" disabled>Warning</re-button>
    <re-button type="danger" disabled>Danger</re-button>
    <re-button type="info" disabled>Info</re-button>
  </div>
  <div class="pt-1em">
    <re-button plain disabled>Plain</re-button>
    <re-button type="primary" plain disabled>Primary</re-button>
    <re-button type="success" plain disabled>Success</re-button>
    <re-button type="warning" plain disabled>Warning</re-button>
    <re-button type="danger" plain disabled>Danger</re-button>
    <re-button type="info" plain disabled>Info</re-button>
  </div>
  <div class="pt-1em">
    <re-button dashed disabled>Dashed</re-button>
    <re-button type="primary" dashed disabled>Primary</re-button>
    <re-button type="success" dashed disabled>Success</re-button>
    <re-button type="warning" dashed disabled>Warning</re-button>
    <re-button type="danger" dashed disabled>Danger</re-button>
    <re-button type="info" dashed disabled>Info</re-button>
  </div>
</template>

Use link attribute to create a button that looks like a link.

Basic Link Button

Link Button with Icon

Disabled Link Button

vue
<template>
  <p>Basic Link Button</p>
  <re-button link>Default</re-button>
  <re-button link type="primary">Primary</re-button>
  <re-button link type="success">Success</re-button>
  <re-button link type="warning">Warning</re-button>
  <re-button link type="danger">Danger</re-button>
  <re-button link type="info">Info</re-button>
  <p>Link Button with Icon</p>
  <re-button link icon="search-bold">Search</re-button>
  <re-button type="danger" link icon="delete">Delete</re-button>
  <p>Disabled Link Button</p>
  <re-button link disabled>Default</re-button>
  <re-button link type="primary" disabled>Primary</re-button>
  <re-button link type="success" disabled>Success</re-button>
  <re-button link type="warning" disabled>Warning</re-button>
  <re-button link type="danger" disabled>Danger</re-button>
  <re-button link type="info" disabled>Info</re-button>
</template>

Text Button

Use textpadding and bg attribute to create a text button.

Basic Text Button

Text Button with icon

Text Button with padding

Text Button with padding and background

Disabled Text Button

Disabled Text Button with padding

Disabled Text Button with padding and background

vue
<template>
  <p>Basic Text Button</p>
  <re-button text>Default</re-button>
  <re-button text type="primary">Primary</re-button>
  <re-button text type="success">Success</re-button>
  <re-button text type="warning">Warning</re-button>
  <re-button text type="danger">Danger</re-button>
  <re-button text type="info">Info</re-button>
  <p>Text Button with icon</p>
  <re-button text icon="search">Default</re-button>
  <re-button text icon="search-bold" type="primary">Primary</re-button>
  <re-button text icon="delete" type="danger">Danger</re-button>
  <re-button text icon="close" type="info">Info</re-button>
  <p>Text Button with padding</p>
  <re-button text padding>Default</re-button>
  <re-button text padding type="primary">Primary</re-button>
  <re-button text padding type="success">Success</re-button>
  <re-button text padding type="warning">Warning</re-button>
  <re-button text padding type="danger">Danger</re-button>
  <re-button text padding type="info">Info</re-button>
  <p>Text Button with padding and background</p>
  <re-button text bg>Default</re-button>
  <re-button text bg type="primary">Primary</re-button>
  <re-button text bg type="success">Success</re-button>
  <re-button text bg type="warning">Warning</re-button>
  <re-button text bg type="danger">Danger</re-button>
  <re-button text bg type="info">Info</re-button>
  <p>Disabled Text Button</p>
  <re-button text disabled>Default</re-button>
  <re-button text disabled type="primary">Primary</re-button>
  <re-button text disabled type="success">Success</re-button>
  <re-button text disabled type="warning">Warning</re-button>
  <re-button text disabled type="danger">Danger</re-button>
  <re-button text disabled type="info">Info</re-button>
  <p>Disabled Text Button with padding</p>
  <re-button text padding disabled>Default</re-button>
  <re-button text padding disabled type="primary">Primary</re-button>
  <re-button text padding disabled type="success">Success</re-button>
  <re-button text padding disabled type="warning">Warning</re-button>
  <re-button text padding disabled type="danger">Danger</re-button>
  <re-button text padding disabled type="info">Info</re-button>
  <p>Disabled Text Button with padding and background</p>
  <re-button text bg disabled>Default</re-button>
  <re-button text bg disabled type="primary">Primary</re-button>
  <re-button text bg disabled type="success">Success</re-button>
  <re-button text bg disabled type="warning">Warning</re-button>
  <re-button text bg disabled type="danger">Danger</re-button>
  <re-button text bg disabled type="info">Info</re-button>
</template>

Icon Button

The icon attribute enables the creation of an icon button. It supports two types of values:
String: A Rappel-UI icon name.
Object: An icon component.
Note that if you pass an arbitrary String, it will be applied as the <i> tag's class name, which requires you to import the icon font beforehand

String Icon Button

Component Icon Button

Circle Text Icon Button

Other String Icon Button

vue
<template>
  <p>String Icon Button</p>
  <re-button type="primary" icon="search">Primary</re-button>
  <re-button type="success" icon="search-bold">Success</re-button>
  <re-button type="warning" icon="arrow-forward">Warning</re-button>
  <re-button type="danger" icon="delete">Danger</re-button>
  <re-button type="info" icon="close">Info</re-button>
  <p>Component Icon Button</p>
  <re-button type="primary" title="search" :icon="Search"></re-button>
  <re-button type="success" title="search" :icon="SearchBold"></re-button>
  <re-button type="warning" title="previous" :icon="ArrowForward"></re-button>
  <re-button type="danger" title="delete" :icon="Delete"></re-button>
  <re-button type="info" title="close" :icon="Close"></re-button>
  <p>Circle Text Icon Button</p>
  <re-button plain circle title="collect" icon="star"></re-button>
  <re-button text circle title="copy"><Copy size="1.25em" /></re-button>
  <re-button
    text
    circle
    :title="isCollected ? 'uncollect' : 'collect'"
    :icon="isCollected ? StarFill : Star"
    @click.stop="toggle()"
  ></re-button>
  <p>Other String Icon Button</p>
  <re-button type="primary" icon="other-icon-lib">Primary</re-button>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import {
  Search,
  SearchBold,
  Delete,
  Close,
  ArrowForward,
  Copy,
  Star,
  StarFill
} from '@rappel-ui/svg-icons'

const isCollected = ref<boolean>(false)
const toggle = () => {
  isCollected.value = !isCollected.value
}
</script>

Loading Button

Use loading and loading-icon attribute to create a loading button.

vue
<template>
  <re-button type="primary" loading disabled>Default</re-button>
  <re-button type="primary" loading loading-icon="close" disabled>String</re-button>
  <re-button type="primary" loading :loading-icon="Star" disabled>Component</re-button>
</template>
<script lang="ts" setup>
import { Star } from '@rappel-ui/svg-icons'
</script>

Sizes

Use size attribute to adjust the button size, besides the default size, it accepts largesmallmini as values.

Common Button Sizes

Round Button Sizes

Circle Button Sizes

vue
<template>
  <p>Common Button Sizes</p>
  <re-button size="large">Large</re-button>
  <re-button>Default</re-button>
  <re-button size="small">Small</re-button>
  <re-button size="mini">Mini</re-button>
  <p>Round Button Sizes</p>
  <re-button size="large" round>Large</re-button>
  <re-button round>Default</re-button>
  <re-button size="small" round>Small</re-button>
  <re-button size="mini" round>Mini</re-button>
  <p>Circle Button Sizes</p>
  <re-button size="large" icon="search-bold" circle />
  <re-button icon="search-bold" circle />
  <re-button icon="search-bold" size="small" circle />
  <re-button icon="search-bold" size="mini" circle />
</template>

Button Group

Use <re-button-group> component to group the buttons.

Basic Button Group

Round Button Group

Vertical Button Group

vue
<template>
  <p>Basic Button Group</p>
  <re-button-group>
    <re-button icon="arrow-forward"></re-button>
    <re-button>b1</re-button>
    <re-button>b2</re-button>
    <re-button icon="arrow-backward"></re-button>
  </re-button-group>
  <re-button-group class="ml-2em" type="primary">
    <re-button icon="arrow-forward"></re-button>
    <re-button>b1</re-button>
    <re-button>b2</re-button>
    <re-button icon="arrow-backward"></re-button>
  </re-button-group>
  <p>Round Button Group</p>
  <re-button-group type="primary">
    <re-button icon="arrow-forward" round></re-button>
    <re-button>b1</re-button>
    <re-button>b2</re-button>
    <re-button icon="arrow-backward" round></re-button>
  </re-button-group>
  <p>Vertical Button Group</p>
  <re-button-group type="primary" direction="vertical">
    <re-button icon="arrow-upward"></re-button>
    <re-button>b1</re-button>
    <re-button>b2</re-button>
    <re-button icon="arrow-downward"></re-button>
  </re-button-group>
</template>

Button Attributes

NameDescriptionTypeDefault
typeButton typeenum
sizeButton size'large' | 'small' | 'mini'
disabledDisable buttonboolean
linkWhether it's a link buttonboolean
textWhether it's a text buttonboolean
paddingWhether the text button has paddingboolean
bgWhether the text button has padding and backgroundboolean
plainWhether it's a plain buttonboolean
roundWhether it's a round buttonboolean
circleWhether it's a circle buttonboolean
dashedWhether it's a dashed buttonboolean
loadingWhether it's a loading buttonboolean
loading-iconCustomize loading iconstring | ComponentLoading
iconButton prefix iconstring | Component
autofocusNative button autofocusboolean
native-typeNative button type'button'| 'submit' | 'reset'button

Button Slots

NameDescription
defaultCustomize default content
loadingCustomize loading Component
iconCustomize prefix icon Component

Button Exposes

NameDescriptionType
refButton html elementRef<HTMLButtonElement>

ButtonGroup Attributes

NameDescriptionTypeDefault
typeButton type, it's priority is lower than type attribute'primary' | 'success' | 'warning' | 'danger' | 'info'
sizeButton size, it's priority is lower than size attribute'large' | 'small' | 'mini'
directionButton group layout direction'horizontal' | 'vertical'horizontal

ButtonGroup Slots

NameDescription
defaultCustomize button group content

MIT License