# Card

Source: https://ecosphere.dev/docs/layout/card (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

The resting surface: one border, --el-rest, and no lift on hover.

`import { EcoCard } from "vue-ecosphere"`

## Stat card

An eyebrow and a figure on the left of the head, period controls on the right.

Vue (vue-ecosphere):

```vue
<EcoCard eyebrow="Requests closed" body-style="padding-top: 6px">
  <template #head>
    <div class="stat__value">
      <span class="stat__n">18</span>
      <span class="stat__delta"><i class="ri-arrow-up-line" aria-hidden="true"></i>32%</span>
    </div>
  </template>
  <template #actions>
    <div class="wknav">…</div>
  </template>
  <svg class="plot" viewBox="0 0 554 172" role="img" aria-label="Requests closed, This week">…</svg>
</EcoCard>
```

React (react-ecosphere):

```tsx
<EcoCard
  eyebrow="Requests closed"
  bodyStyle={{ paddingTop: 6 }}
  head={
    <div className="stat__value">
      <span className="stat__n">18</span>
      <span className="stat__delta"><i className="ri-arrow-up-line" aria-hidden="true"></i>32%</span>
    </div>
  }
  actions={<div className="wknav">…</div>}
>
  <svg className="plot" viewBox="0 0 554 172" role="img" aria-label="Requests closed, This week">…</svg>
</EcoCard>
```

## Upcoming

A card title with one link opposite it, and rows in the body.

Vue (vue-ecosphere):

```vue
<EcoCard title="Upcoming" class="upcoming">
  <template #actions>
    <button class="link" type="button">Calendar<i class="arr ri-arrow-right-line" aria-hidden="true"></i></button>
  </template>
  <button class="urow" type="button">
    <span class="urow__l"><span class="urow__time">9:00 AM</span><span class="urow__day">Today</span></span>
    <span class="urow__b"><span class="urow__n">Deploy window</span><span class="urow__h">Release 4.12 · Northwind</span></span>
    <i class="urow__go ri-arrow-right-s-line" aria-hidden="true"></i>
  </button>
  …
</EcoCard>
```

React (react-ecosphere):

```tsx
<EcoCard
  title="Upcoming"
  className="upcoming"
  actions={
    <button className="link" type="button">Calendar<i className="arr ri-arrow-right-line" aria-hidden="true"></i></button>
  }
>
  <button className="urow" type="button">
    <span className="urow__l"><span className="urow__time">9:00 AM</span><span className="urow__day">Today</span></span>
    <span className="urow__b"><span className="urow__n">Deploy window</span><span className="urow__h">Release 4.12 · Northwind</span></span>
    <i className="urow__go ri-arrow-right-s-line" aria-hidden="true"></i>
  </button>
  …
</EcoCard>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `eyebrow` | `string` | — | Small caps label at the top of the head. #eyebrow slot overrides it. |
| `title` | `string` | — | Card title (card-title). #title slot overrides it. |
| `as` | `"h2" \| "h3" \| "h4"` | "h2" | Heading level of the title. |
| `tag` | `string` | "div" | Element to render (use section for a landmark card). |
| `flush` | `boolean` | false | No body padding, for tables and timetables that run to the edge. |
| `bodyStyle` | `StyleValue` | — | Inline style on card__body (the stat card trims its top padding to 6px under the head). |
| `#head` | `slot` | — | More content under the eyebrow on the left of the head (a stat value). |
| `#actions` | `slot` | — | Controls on the right of the head: a link, a range picker, icon buttons. |
| `default` | `slot` | — | The body (card__body). |
| `#footer` | `slot` | — | After the body, edge to edge. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `eyebrow` | `ReactNode` | — | Small caps label at the top of the head: text or a node. |
| `title` | `ReactNode` | — | Card title (card-title): text or a node. |
| `as` | `"h2" \| "h3" \| "h4"` | "h2" | Heading level of the title. |
| `tag` | `ElementType` | "div" | Element to render (use section for a landmark card). |
| `flush` | `boolean` | false | No body padding, for tables and timetables that run to the edge. |
| `bodyStyle` | `CSSProperties` | — | Inline style on card__body (the stat card trims its top padding to 6px under the head). |
| `head` | `ReactNode` | — | More content under the eyebrow on the left of the head (a stat value). |
| `actions` | `ReactNode` | — | Controls on the right of the head: a link, a range picker, icon buttons. |
| `children` | `ReactNode` | — | The body (card__body). |
| `footer` | `ReactNode` | — | After the body, edge to edge. |
