Card #
The va-card
is a multipurpose representative component that can be used for anything from links to articles. It has some helper components to make markup easier.
Examples #
Default #
This is default va-card
implementation using va-card-title
, va-card-content
and va-card-actions
helper components.
Color and gradient #
Tag #
Changed tag to <b>
Border, shadow and shape #
Disabled #
Card as link #
Stripe #
Image #
Horizontal #
Actions #
The VaCardActions
component is designed to apply margins and alignment to content (VaButtons
expected).
Two properties can be passed: align
(string, specify how to align actions) and vertical
(boolean, display actions one below the other).
Valid values for align
: left, center, right, between, around, stretch.
API #
Props #
Name | Description | Types | Default |
---|---|---|---|
activeClass | Applied when the link is active. More info here. |
| - |
append | When set, always appends the relative path to the current path. More info here. |
| - |
bordered | Toggles borders of a card component. |
|
|
color | Color of the component (theme string or |
|
|
disabled | Applies |
|
|
exact | Exactly match the link. Without this, '/' will match every route. More info here. |
| - |
exactActiveClass | Applied when the link is active with exact match. More info here. |
| - |
gradient | Adds color gradient to |
|
|
href | Designates the component as anchor and applies the href attribute. More info here. |
|
|
outlined | Toggles shadow of |
|
|
preset | Named preset combination of component props. |
| - |
replace | When set, calls |
| - |
square | Removes rounded corners. |
|
|
stripe | Displays a stripe above a card title. |
|
|
stripeColor | Customize stripe color (theme string or HEX string). |
|
|
tag | Replaces html tag. This is useful for semantics and also to allow for valid markup in some cases ( |
|
|
target | Navigation target, More info here. |
|
|
textColor | Text color (theme string or HEX string). |
| - |
to | The target route of the link. More info here. |
| - |
Events #
Name | Description |
---|---|
click | On click.. The event argument is:
|
Css Variables #
Name | Default Value |
---|---|
--va-card-display | block |
--va-card-position | relative |
--va-card-overflow | visible |
--va-card-box-shadow | var(--va-box-shadow) |
--va-card-border-radius | 0.375rem |
--va-card-color | #34495e |
--va-card-background-color | var(--va-background-secondary) |
--va-card-padding | 1.25rem |
--va-card-outlined-border | 3px solid var(--va-background-border) |
--va-card-outlined-box-shadow | none |
--va-card-stripe-border-size | var(--va-stripe-border-size) |
--va-card-dark-color | #ffffff |
--va-card-dark-background-color | #34495e |
--va-card-actions-btn-margin | 4px |
FAQ #
Can I use va-card
without helper components? #
va-card
without helper components?Yes, if you don't like our styling preset, you are free to use your own.
Should I manually set tag if I use link attributes? #
No, we will do it for you. If tag is not set, but href
is, component tag will be <a>
, if any of router-link prop is set, it will be <router-link>
.