Cards
Cards present information with a bordered box.
Cards are added to Rancher via the addCard method.
addCard
(Rancher version v2.7.2)
This method adds a card element to the UI.
Method:
plugin.addCard(where: String, when: LocationConfig, options: Object);
Arguments
where string parameter admissable values for this method:
| Key | Type | Rancher Version | Description |
|---|---|---|---|
CardLocation.CLUSTER_DASHBOARD_CARD | String | v2.7.2 | Location for a card on the Cluster Dashboard page |
CardLocation.RESOURCE_DETAIL_CARD | String | v2.17.0 | Location for a card in the row of cards on a resource detail page |
when Object admissable values:
LocationConfig as described above for the LocationConfig object.
CardLocation.CLUSTER_DASHBOARD_CARD options
(From Rancher version v2.7.2)

options config object. Admissable parameters for the options with 'CardLocation.CLUSTER_DASHBOARD_CARD' are:
| Key | Type | Description |
|---|---|---|
label | String | Card title |
labelKey | String | Same as "label" but allows for translation. Will superseed "label" |
component | Function | Component to be rendered aas content of a "Cluster Dashboard Card" |
weight (From Rancher version v2.17.0) | Number | Optional. Order of the card amongst the other extension cards in the same location, highest first. Defaults to 0. Cards of equal weight registered by the same extension keep the order they were added in; across extensions the tie falls back to extension load order, so give a card a distinct weight to place it relative to another extension's card |
Usage example for 'CardLocation.CLUSTER_DASHBOARD_CARD':
plugin.addCard(
CardLocation.CLUSTER_DASHBOARD_CARD,
{ cluster: ['local'] },
{
label: 'some-label',
labelKey: 'generic.comingSoon',
component: () => import('./MastheadDetailsComponent.vue'),
weight: 100
}
);
CardLocation.RESOURCE_DETAIL_CARD options
(From Rancher version v2.17.0)

Resource detail pages show a row of cards under the masthead, which Rancher fills with cards such as Resources and Insights. An extension can add its own cards to that row for any resource type, including resource types that have no cards of their own.
options config object. Admissable parameters for the options with 'CardLocation.RESOURCE_DETAIL_CARD' are:
| Key | Type | Description |
|---|---|---|
label | String | Card title |
labelKey | String | Same as "label" but allows for translation. Will superseed "label" |
component | Function | Component to be rendered as the content of the card |
weight | Number | Optional. Order of the card amongst the other extension cards, highest first. Defaults to 0. Cards of equal weight registered by the same extension keep the order they were added in; across extensions the tie falls back to extension load order, so give a card a distinct weight to place it relative to another extension's card. Extension cards always come after the cards Rancher adds itself |
Rancher renders the card itself - the border and the title come from the same component the built-in cards use, and your component is rendered as the body of the card. The component is given the resource being viewed as a resource prop.
Where the card appears
The card is shown on the resource detail page in view mode, alongside the cards Rancher adds itself.
It is not shown:
- while creating or editing a resource
- on the legacy detail page (
?legacy=true), which has no row of cards at all - Rancher's own cards are not shown there either. Resource types that have fully moved to the new detail page ignore that flag, so their cards are still shown
Usage example for 'CardLocation.RESOURCE_DETAIL_CARD':
plugin.addCard(
CardLocation.RESOURCE_DETAIL_CARD,
{ resource: ['pod'] },
{
label: 'some-label',
labelKey: 'generic.comingSoon',
component: () => import('./PodDetailCard.vue'),
weight: 10
}
);
And the component itself, PodDetailCard.vue:
<script setup lang="ts">
defineProps<{ resource: any }>();
</script>
<template>
<div>
{{ resource.metadata.name }} is running {{ resource.spec.containers.length }} container(s)
</div>
</template>