The Card component is a part of a UI library built with React and Tailwind CSS. This component is designed to display content in a flexible and customizable card format.
The Card component supports various sub-components such asPicture, Header, Title, Description, Content, and Footer, allowing users to structure the card layout easily.
Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.
import { Avatar } from "mogora-ui";
export default function CardDemo() {
return (
<Card>
<Card.Picture
src="https://i.pinimg.com/474x/d5/c1/13/d5c113254075c85d44d44496b4c44c40.jpg"
className="h-64 object-cover"
/>
<Card.Content>
<div className="flex justify-between items-center">
<Card.Title>Biggest enterprise</Card.Title>
<Popover>
<Popover.Trigger>
<button className="hover:bg-gray-300 p-1 rounded-md">
<EllipsisVertical size={20} />
</button>
</Popover.Trigger>
<Popover.Content className="w-32">
<button className="hover:bg-gray-200 rounded-md w-full py-1">
Edit
</button>
<button className="hover:bg-gray-200 rounded-md w-full py-1">
Delete
</button>
<button className="hover:bg-gray-200 rounded-md w-full py-1">
Report
</button>
</Popover.Content>
</Popover>
</div>
<Card.Description>
Here are the biggest enterprise technology acquisitions of 2021
so far, in reverse chronological order.
</Card.Description>
</Card.Content>
</Card>
)
}
The main wrapper component for other sub-components.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
Displays an image inside the card.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
...props | ImgHTMLAttributes<HTMLImageElement> | Inherits all default attributes of the <img> |
The top section of the card, usually containing the title.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
children | ReactNode | Elements inside the header. |
...props | HTMLAttributes<HTMLDivElement> | Inherits all default attributes of the <div> |
Displays the title inside the card.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
children | ReactNode | Title text or elements. |
Displays a description or additional text inside the card.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
children | ReactNode | Description text. |
The main section of the card for primary content.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
children | ReactNode | Elements inside the content. |
The bottom section of the card, usually containing buttons or additional information.
Prop | Type | Description |
---|---|---|
className | string | Additional styling classes. |
children | ReactNode | Elements inside the footer. |
By using the Card component, you can create elegant and easily customizable card layouts for your React application.