ContentCard
The ContentCard component is a versatile and flexible card component used to display content with an optional image, title, body, and footer. The card can be used in a vertical or horizontal layout and can be customized with various styles such as border-radius, shadow, and outline.
Importing
Import the components as follows:
_10import {_10 ContentCard,_10 CardBody,_10 CardFooter,_10 CardImage,_10 CardTitle,_10} from '@ef-global/backpack/ContentCard';
Usage
To create a ContentCard, use the ContentCard component and add the required child components.
_10 <ContentCard href='/example'>_10 <CardImage src='path/to/image.jpg' alt='Example' />_10 <CardTitle>Title of the Card</CardTitle>_10 <CardBody>TSome description or content about the card.</CardBody>_10 <CardFooter>Card Footer</CardFooter>_10 </ContentCard>
Props
| Name | Type | Default | Description |
| horizontal | boolean | false | Set to true to display the card in a horizontal layout. |
| arrow | boolean | false | Set to true to display an arrow icon in the card. |
| href | string | The URL to navigate to when the card is clicked. | |
| target | '_blank' | Set to _blank to open the link in a new tab. | |
| radius | CardBorderRadiusValues | The border-radius of the card. Accepted values: 'sm', 'md', 'lg', 'xl', 'xxl', 'round'. | |
| shadow | CardShadowValues | The shadow depth of the card. Accepted values: 'sm', 'md', 'lg', 'xl', 'xxl'. | |
| outline | boolean | false | Set to true to display an outline around the card. |
| renderCustomLink | React.ElementType | The custom link component to be used. | |
| children | ReactNode or Array of ReactNodes (see Slots) | The child components that make up the ContentCard. |
Examples
Here are a few examples of how to use the ContentCard component:
Basic ContentCard
_10 <ContentCard>_10 <CardImage src="path/to/image.jpg" alt="Example Image" />_10 <CardTitle>Title of the Card</CardTitle>_10 <CardBody>Some description or content about the card.</CardBody>_10 </ContentCard>
ContentCard with Custom Image Ratio
_10 <ContentCard href="https://www.example.com" arrow>_10 <CardImage src="path/to/image.jpg" alt="Example Image" />_10 <CardTitle>Title of the Card</CardTitle>_10 <CardBody>Some description or content about the card.</CardBody>_10 </ContentCard>
ContentCard with Arrow
_10 <ContentCard href="https://www.example.com" arrow>_10 <CardImage src="path/to/image.jpg" alt="Example Image" />_10 <CardTitle>Title of the Card</CardTitle>_10 <CardBody>Some description or content about the card.</CardBody>_10 </ContentCard>
ContentCard with Custom radius
_10 <ContentCard href="https://www.example.com" radius='m'>_10 <CardImage src="path/to/image.jpg" alt="Example Image" />_10 <CardTitle>Title of the Card</CardTitle>_10 <CardBody>Some description or content about the card.</CardBody>_10 </ContentCard>
HeaderItemLeft and HeaderItemRight
The HeaderItemLeft and HeaderItemRight components are used to display content aligned to the left and right sides of a card header.
Importing
Import the components as follows:
_10import { HeaderItemLeft, HeaderItemRight } from '@ef-global/backpack/ContentCard';
Usage
To use the components, add them as children components inside the ContentCard component:
_10<ContentCard>_10 <HeaderItemLeft>_10 {/* Your left-aligned content here */}_10 </HeaderItemLeft>_10 <HeaderItemRight>_10 {/* Your right-aligned content here */}_10 </HeaderItemRight>_10 {/* Other ContentCard child components */}_10</ContentCard>
Examples
Here are a few examples of how to use the ContentCard component with HeaderItemLeft and HeaderItemRight:
ContentCard with HeaderItemLeft
_10<ContentCard href='/example'>_10 <CardImage src={imageSrc} alt='Example image' />_10 <CardTitle>Card Title</CardTitle>_10 <CardBody>Optional card body text.</CardBody>_10 <HeaderItemLeft>_10 <Tag tagType='label' value='left'>_10 <TagText>Left Header Item</TagText>_10 </Tag>_10 </HeaderItemLeft>_10</ContentCard>
ContentCard with HeaderItemRight
_10<ContentCard href='/example'>_10 <CardImage src={imageSrc} alt='Example image' />_10 <CardTitle>Card Title</CardTitle>_10 <CardBody>Optional card body text.</CardBody>_10 <HeaderItemRight>_10 <Tag tagType='label' value='right'>_10 <TagText>Right Header Item</TagText>_10 </Tag>_10 </HeaderItemRight>_10</ContentCard>
ContentCard with Both HeaderItemLeft and HeaderItemRight
_15<ContentCard href='/example'>_15 <CardImage src={imageSrc} alt='Example image' />_15 <CardTitle>Card Title</CardTitle>_15 <CardBody>Optional card body text.</CardBody>_15 <HeaderItemLeft>_15 <Tag tagType='label' value='left'>_15 <TagText>Left Header Item</TagText>_15 </Tag>_15 </HeaderItemLeft>_15 <HeaderItemRight>_15 <Tag tagType='label' value='right'>_15 <TagText>Right Header Item</TagText>_15 </Tag>_15 </HeaderItemRight>_15</ContentCard>
)
)