Vivid API

Button

Buttons trigger an action, such as submitting a form, closing a dialog, or navigating to a new page.

Usage

import { registerButton } from '@vonage/vivid-api';
registerButton('your-prefix');

Use the href attribute to change the button to a link. When doing so, all of the native attributes of <a> are supported, including target.

Semantically, buttons are usually used for triggering actions, while links are used for navigation. Mixing these semantics might lead to confusion or unexpected behavior for users.

See Client-Side Navigation for more information on how to integrate with Vue Router.

Slots

Icon Slot

Use the icon slot to customise icons. If set, the icon attribute is ignored.

CSS Variables

Button Content Alignment

When dropdown-indicator is set button, the content alignment is set to start.
If center is needed, set --button-content-alignment: center;.

API Reference

Properties

PropertyTypeDefaultDescription
activebooleanDisplays the button in active state.
appearance'ghost' | 'filled' | 'outlined' | 'ghost-light' | 'outlined-light'The appearance the button should have.
autofocusbooleanDetermines if the element should receive document focus on page load.
connotation'alert' | 'accent' | 'cta' | 'success' | 'announcement'The connotation the button should have.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
downloadstringPrompts the user to save the linked URL. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
dropdownIndicatorbooleanDisplay a chevron to indicate that the button opens a dropdown.
formIdstringThe id of a form to associate the element to.
formactionstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formenctypestringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formmethodstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formnovalidatebooleanSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formtarget'_self' | '_blank' | '_parent' | '_top'See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
hrefstringThe URL the hyperlink references. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
hreflangstringHints at the language of the referenced resource. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
iconTrailingbooleanIndicates the icon affix alignment.
initialValuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringIndicates the button's label.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
pendingbooleanDisplays the button in pending state.
pingstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
pressedbooleanIndicates the button is in a pressed/toggled state. Sets `aria-pressed` on the button element.
referrerpolicystringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
relstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
requiredbooleanRequire the field to be completed prior to form submission.
shape'rounded' | 'pill'The shape the button should have.
size'condensed' | 'normal' | 'expanded' | 'super-condensed'The size the button should have.
stackedbooleanIndicates the icon is stacked.
target'_self' | '_blank' | '_parent' | '_top'See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
titlestringSpecifies extra information about the button. This information is typically used by browsers to display a tooltip.
typestringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
valuestringThe current value of the element.
PropertyTypeDefaultDescription
activebooleanDisplays the button in active state.
appearance'ghost' | 'filled' | 'outlined' | 'ghost-light' | 'outlined-light'The appearance the button should have.
autofocusbooleanDetermines if the element should receive document focus on page load.
connotation'alert' | 'accent' | 'cta' | 'success' | 'announcement'The connotation the button should have.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
downloadstringPrompts the user to save the linked URL. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
dropdown-indicatorbooleanDisplay a chevron to indicate that the button opens a dropdown.
formstringThe id of a form to associate the element to.
formactionstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formenctypestringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formmethodstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formnovalidatebooleanSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
formtarget'_self' | '_blank' | '_parent' | '_top'See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element for more details.
hrefstringThe URL the hyperlink references. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
hreflangstringHints at the language of the referenced resource. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
icon-trailingbooleanIndicates the icon affix alignment.
valuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringIndicates the button's label.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
pendingbooleanDisplays the button in pending state.
pingstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
pressedbooleanIndicates the button is in a pressed/toggled state. Sets `aria-pressed` on the button element.
referrerpolicystringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
relstringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
requiredbooleanRequire the field to be completed prior to form submission.
shape'rounded' | 'pill'The shape the button should have.
size'condensed' | 'normal' | 'expanded' | 'super-condensed'The size the button should have.
stackedbooleanIndicates the icon is stacked.
target'_self' | '_blank' | '_parent' | '_top'See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
titlestringSpecifies extra information about the button. This information is typically used by browsers to display a tooltip.
typestringSee https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
current-valuestringThe current value of the element.

Slots

NameDescription
iconThe preferred way to add an icon to the component.
NameDescription
iconThe preferred way to add an icon to the component.

Methods

NameParamsReturnsDescription
checkValiditybooleanReturn the current validity of the element.
reportValiditybooleanReturn the current validity of the element. If false, fires an invalid event at the element.
validatevoid{@inheritDoc (FormAssociated:interface).validate}