# Card

The `Card` component displays a card with a header, content, and footer. It provides an organized way to present information with optional loading states and alignment features.

## Preview

<div align="left"><figure><img src="/files/CmFBxhXuvKpfBR5dqkHQ" alt="Gravity card component" width="375"><figcaption></figcaption></figure></div>

### Usage

```javascript
import { Card } from 'components/lib';

function MyComponent({ ...props }){

  return (
    <Card title='Card Title' description='Card Description'>
      Card content goes here.
    </Card>
  );
}
```

### Props

| Prop        | Description                                 | Required | Value            |
| ----------- | ------------------------------------------- | -------- | ---------------- |
| center      | align the card in the center of it's parent | optional | boolean          |
| children    | children to render                          | required | component(s)     |
| className   | custom style                                | optional | SCSS or Tailwind |
| description | header description                          | optional | string           |
| loading     | toggle the loading spinner                  | optional | boolean          |
| title       | header title                                | optional | string           |

### Example

```javascript
import { Card, Table, useAPI } from 'components/lib';

function Example({ ...props }){

 const { data, loading } from useAPI('/api/user');

  return (
    <div>
      <Card title='Card Title' description='Card Description' loading={ loading }>
        <Table data={ data }/>
      </Card>
    </div>
  );
}

```

### Notes

* The `Card` component uses `cn` and `Loader` from `'components/lib'`.
* The `center` prop aligns the card in the center of its parent.
* The `loading` prop toggles a loading animation.
* The `children` prop can include a React component(s) or `CardHeader`, `CardContent`, and `CardFooter` components.
* For more details, refer to the [Shadcn Card documentation](https://ui.shadcn.com/docs/components/card).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usegravity.app/gravity-web/components/card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
