Skip to content

Card

The Card component is a flexible and extensible content container. Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. They are particularly well-suited to use with the Modal component.

Examples

Base

A simple Card is created with a title and content property.

Slots

The component provides header, title, subtitle, content and footer as named slot templates to customise content.

Image

You can place an image below the header.

Form

A useful purpose for a card is to display forms in it.

Card Component

A flexible and extensible content container.

html
<o-card></o-card>

Props

Prop nameDescriptionTypeValuesDefault
ariaCloseLabelAccessibility label for the close buttonstring-
From config:
card: {
  ariaCloseLabel: "Close"
}
closeIconClose icon namestring-
From config:
card: {
  closeIcon: "close"
}
closeIconSizeClose icon sizestring-
From config:
card: {
  closeIconSize: undefined
}
closeableAdds close button to the headerboolean-
From config:
card: {
  closeable: false
}
componentComponent to be injected.
Close the component by emitting a 'close' event — $emit('close')
Component-
contentCard body content, unnecessary when content slot is usedstring-
eventsEvents to be binded to the injected component{}-
iconPackIcon pack to use for the close iconstringmdi, fa, fas and any other custom icon pack
From config:
card: {
  iconPack: undefined
}
imageAltCard image alt, unnecessary when image slot is usedstring-
imageSrcCard image src, unnecessary when image slot is usedstring-
loadingShow a loading spinner in the cardboolean-
loadingLabelShow label beside the loading iconstring-
overrideOverride existing theme classes completelyboolean-
propsProps to be binded to the injected componentany-
subtitleCard header subtitle, unnecessary when subtitle slot is used
Class of the header subtitle element
(string & ComponentClass)-
titleCard header title, unnecessary when title slot is usedstring-

Events

Event namePropertiesDescription
closeevent Event - native eventclose button click event

Slots

NameDescriptionBindings
headerOverride the headerclose (event: Event): void - function to emit a close event
titleOverride the header title, default is title prop
subtitleOverride the header subtitle, default is subtitle prop
closeOverride the close icon
imageOverride the image
defaultOverride the default card bodyclose (event: Event): void - function to emit a close event
contentOverride the body content, default is content propclose (event: Event): void - function to emit a close event
footerOverride the footerclose (event: Event): void - function to emit a close event

Class Inspector

Classes applied to the element:
Class propDescriptionPropsSuffixes
rootClassClass of the root element.
headerClassClass of the header element.
titleClassClass of the header title element.
subtitleClass of the header subtitle element.
closeClassClass of the header close element.
imageClass Class of the image container.
figureClassClass of the image figure element.
bodyClass Class of the body element.
contentClassClass of the body content element.
footerClassClass of the footer element.

Sass Variables

Current theme ➜ Oruga

The theme does not have any custom variables for this component.

Current theme ➜ Bulma

The theme does not have any custom variables for this component.

Current theme ➜ Bootstrap

The theme does not have any custom variables for this component.

Released under the MIT License.