Import
import { UsageCard } from '@contentful/f36-components';// orimport { UsageCard } from '@contentful/f36-usage-card';
Examples
Basic UsageCard of usage variant
function UsageCardUsageExample() {return (<UsageCardvariant="usage"header={<UsageCard.Headertitle="Asset Bandwidth Usage"tooltip="This is a tooltip for the usage card"/>}description={<UsageCard.Description>This is a description of the usage card.{' '}<TextLinktarget="_blank"rel="noopener noreferrer"href={'https://www.contentful.com'}>Learn more</TextLink></UsageCard.Description>}><UsageCountvariant="periodic"value={150}valueUnit="GB"periodType="year"/></UsageCard>);}
Basic UsageCard of info variant
function UsageCardInfoExample() {return (<UsageCardvariant="info"header={<UsageCard.Headertitle="This is an Info Card"tooltip="This is a tooltip for Info Card"/>}description={<UsageCard.Description>This is a description of the info card.{' '}<TextLinktarget="_blank"rel="noopener noreferrer"href={'https://www.contentful.com'}>Learn more</TextLink></UsageCard.Description>}><UsageCountvariant="consumption"value={150}valueUnit="GB"valueDescription="Used this month"/></UsageCard>);}
UsageCard areas
The UsageCard component offers 4 individually setable areas, three of them can be set via the props header, description and variant.
Prop | Description | Recommended child components |
|---|---|---|
children | Elements handed over as children to the UsageCard component will be
rendered as the UsageCard body. The common case is using | UsageCount |
header |
| UsageCard.Header |
description |
| UsageCard.Description with Text or TextLink |
variant |
| N/A |
Props (API reference)
Open in StorybookName | Type | Default |
|---|---|---|
| className | string CSS class to be appended to the root element | |
| description | string number bigint false true ReactElement<unknown, string | JSXElementConstructor<any>> Iterable<ReactNode> ReactPortal Promise<AwaitedReactNode> | |
| header | string number bigint false true ReactElement<unknown, string | JSXElementConstructor<any>> Iterable<ReactNode> ReactPortal Promise<AwaitedReactNode> | |
| testId | string A [data-test-id] attribute used for testing purposes | |
| variant | "usage" "info" The type of the card. | 'usage' |