Skip to content

Buttons - AvButton

✨ Introduction

The AvButton is an interaction element with an interface enabling the user to perform an action.

The AvButton is an elegant, reusable Vue component designed to simplify the creation of custom buttons. It features adjustable sizes, an optional icon and a click manager. It's easy to use, with the flexibility to adapt to different contexts.

The button only allow three variants (DEFAULT without border, OUTLINED with border and FLAT with filled background and border) and two themes (PRIMARY blue and SECONDARY grey).

🏗️ Structure

Buttons consist of :

  • A label - mandatory, using the label prop, enables label display when iconOnly is false, also enables connection to title and aria-label ;
  • An icon, which can be modified (see available icons) - optional.

🏷️ Props

NameTypeDefaultMandatoryDescription
variant'DEFAULT' | 'OUTLINED' | 'FLAT''DEFAULT'Button variant: without border (DEFAULT) or with border (OUTLINED) or with filled background and border (FLAT).
theme'PRIMARY' | 'SECONDARY''PRIMARY'Button theme: blue (PRIMARY) or grey (SECONDARY).
isLoadingbooleanfalseIndicates a loading status for the button.
iconScalenumberundefinedAllows you to manually change the icon size (it is automatically calculated otherwise).
noRadiusbooleanfalseAllows you to remove radii from the button border.
disabledbooleanfalseIndicates the disabled state of the button.
labelstringText label for the button.
iconRightbooleanfalseIndicates the position of the icon in relation to the button text: left (false) or right (true).
iconOnlybooleanfalseHide label text (true) or show it (false).
size'sm' | 'small' | 'lg' | 'large' | 'md' | 'medium' | '' | undefined'md'Button size.
iconstring | InstanceType<typeof AvIcon>['$props']undefinedIcon to be displayed in button. Can be a name or icon configuration.
onClick($event: MouseEvent) => voidundefinedFunction called when button is clicked.

🔊 Events

None.

🎨 Slots

None.

🚀 Storybook demos

You can find examples of use and demo of the component on its dedicated Storybook page.

💡 Examples of use

vue
<template>
  <AvButton
    label="See all"
    :on-click="navigateToStudentDeliverables"
    icon="mdi:arrow-right-thin"
  />
</template>
vue
<template>
  <AvButton
    class="settings-btn"
    icon="mdi:dots-vertical"
    icon-only
    variant="OUTLINED"
    size="sm"
    label="Paramètres de la trace"
    :on-click="toggleSettingsMenu"
  />
</template>
vue
<template>
  <AvButton
    label="Logout"
    icon="mdi:logout"
    variant="DEFAULT"
    theme="SECONDARY"
    size="sm"
    no-radius
  />
</template>