Card

Description

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.

Usage

Biggest enterprise

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>
  )
}

API Reference

Card

The main wrapper component for other sub-components.

PropTypeDescription
classNamestringAdditional styling classes.

Card.Picture

Displays an image inside the card.

PropTypeDescription
classNamestringAdditional styling classes.
...propsImgHTMLAttributes<HTMLImageElement>Inherits all default attributes of the <img>

Card.Header

The top section of the card, usually containing the title.

PropTypeDescription
classNamestringAdditional styling classes.
childrenReactNodeElements inside the header.
...propsHTMLAttributes<HTMLDivElement>Inherits all default attributes of the <div>

Card.Title

Displays the title inside the card.

PropTypeDescription
classNamestringAdditional styling classes.
childrenReactNodeTitle text or elements.

Card.Description

Displays a description or additional text inside the card.

PropTypeDescription
classNamestringAdditional styling classes.
childrenReactNodeDescription text.

Card.Content

The main section of the card for primary content.

PropTypeDescription
classNamestringAdditional styling classes.
childrenReactNodeElements inside the content.

Card.Footer

The bottom section of the card, usually containing buttons or additional information.

PropTypeDescription
classNamestringAdditional styling classes.
childrenReactNodeElements inside the footer.

By using the Card component, you can create elegant and easily customizable card layouts for your React application.