Vivid Logo Vivid

Card

A card is a UI design pattern that groups related information in a flexible-size container visually resembling a playing card

Usage

import { VCard } from '@vonage/vivid-vue';
import { registerCard } from '@vonage/vivid';

registerCard('your-prefix');

Slots

Body Slot

This is the slot for any content that you need to display after header content (Headline, Subtitle). It can be used instead of, or in conjunction with the text attribute.

Graphic Slot

Use the graphic slot for Icons or custom images. The graphic slot overrides the icon property.

Media Slot

The media slot can be used to display images or video content above the card header.

Meta Slot

The meta slot is for action content in the card header.

The footer slot is for content in the card footer.
Use it for adding buttons or action items.
By default - items inside footer slot are aligned to the end.

Main Slot

Card has predefined content style template.
Use the main slot to fully override a card's predefined template with your own. When using main - only appearance and elevation are applied on the card.

CSS Variables

Border color

The card border color can be customized using --card-border-color.

Note: this variable works only with outlined appearance.

Trim headline

The card headline can be trimmed to your preferable number of lines. The number of lines is controlled by the css variable --headline-line-clamp.

Trim subtitle

The card subtitle can be trimmed to your preferable number of lines. The number of lines is controlled by css variable --subtitle-line-clamp.

API Reference

Properties

Property Type Default Description
appearance 'ghost' | 'outlined' | 'elevated' Sets the element's appearance.
clickableCard boolean Indicates whether card should be a clickable <button> element.
download string Prompts the user to save the linked URL. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
elevation 0 | 2 | 4 | 8 | 12 | 16 | 24 Sets the element's elevation.
headline string Sets the element's headline.
href string The URL the hyperlink references. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
hreflang string Hints 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 IconId Sets the element's icon. See the Vivid Icon Gallery for available icons: https://icons.vivid.vonage.com/
ping string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
referrerpolicy string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
rel string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
subtitle string Sets the element's subtitle.
target '_self' | '_blank' | '_parent' | '_top' See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
text string Sets the element's text.
type string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
Property Type Default Description
appearance 'ghost' | 'outlined' | 'elevated' Sets the element's appearance.
clickable-card boolean Indicates whether card should be a clickable <button> element.
download string Prompts the user to save the linked URL. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
elevation 0 | 2 | 4 | 8 | 12 | 16 | 24 Sets the element's elevation.
headline string Sets the element's headline.
href string The URL the hyperlink references. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
hreflang string Hints 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 IconId Sets the element's icon. See the Vivid Icon Gallery for available icons: https://icons.vivid.vonage.com/
ping string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
referrerpolicy string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
rel string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
subtitle string Sets the element's subtitle.
target '_self' | '_blank' | '_parent' | '_top' See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.
text string Sets the element's text.
type string See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element for more information.

Slots

Name Description
body The body slot is for the main content of the card. Displayed between the header and footer content.
footer The footer slot is for content in the card footer.
graphic The graphic slot overrides the icon property.
main Assign nodes to main slot to fully override a card's predefined flow and style with your own.
media The media slot is mainly for images or video content above the card header.
meta The meta slot is for action content in the card header.
Name Description
body The body slot is for the main content of the card. Displayed between the header and footer content.
footer The footer slot is for content in the card footer.
graphic The graphic slot overrides the icon property.
main Assign nodes to main slot to fully override a card's predefined flow and style with your own.
media The media slot is mainly for images or video content above the card header.
meta The meta slot is for action content in the card header.

Events

Event Type Description
blur FocusEvent Fires when the element loses focus.
click MouseEvent Fires when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located inside the element.
focus FocusEvent Fires when the element receives focus.
input Event Fires when the value of an element has been changed.
keydown KeyboardEvent Fires when a key is pressed.
keyup KeyboardEvent Fires when a key is released.
Name Type Description
blur FocusEvent Fires when the element loses focus.
click MouseEvent Fires when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located inside the element.
focus FocusEvent Fires when the element receives focus.
input Event Fires when the value of an element has been changed.
keydown KeyboardEvent Fires when a key is pressed.
keyup KeyboardEvent Fires when a key is released.