# Bento metric card

> A compact stat card: one big number and a row of bars that rise one by one on hover.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-bento
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Made for bento-style dashboards where each tile tells one story: weekly conversion in a store's analytics panel, uptime on a status page, completion rate in an online course. The KPI card shows the figure, a mini bar chart and the change against last week. On hover, the bars wake up in a small wave.

The bars are decorative, not real data, so wire them to your own numbers before going live or remove them. Keep the green for good news only; if the change is negative, switch it to red, or people will read every drop as progress.

## Code

### HTML

```html
<article class="uv-cbento"><header><span>↗</span><div><small>This week</small><h3>Performance</h3></div></header><strong>84<sup>%</sup></strong><div class="bars"><i style="--h:30%;--i:0"></i><i style="--h:47%;--i:1"></i><i style="--h:64%;--i:2"></i><i style="--h:81%;--i:3"></i><i style="--h:33%;--i:4"></i><i style="--h:50%;--i:5"></i><i style="--h:67%;--i:6"></i><i style="--h:84%;--i:7"></i><i style="--h:36%;--i:8"></i><i style="--h:53%;--i:9"></i><i style="--h:70%;--i:10"></i><i style="--h:87%;--i:11"></i></div><footer><b>+12.4%</b><span>vs. last week</span></footer></article>
```

### CSS

```css
.uv-cbento {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uv-cbento {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 17em;
  padding: 1.3em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 18px 50px -35px #000;
}

.uv-cbento header {
  display: flex;
  gap: .8em;
  align-items: center;
}

.uv-cbento header>span {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: .75em;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uv-cbento small {
  opacity: .48;
}

.uv-cbento h3 {
  margin: .12em 0;
  font-size: .95em;
}

.uv-cbento strong {
  display: block;
  margin: .6em 0 .25em;
  font-size: 3em;
  font-weight: 500;
}

.uv-cbento sup {
  font-size: .42em;
}

.uv-cbento .bars {
  height: 5em;
  display: flex;
  align-items: end;
  gap: .3em;
}

.uv-cbento .bars i {
  flex: 1;
  height: var(--h);
  border-radius: 999px;
  background: color-mix(in srgb,var(--c1) 20%,transparent);
  transform-origin: bottom;
  transition: all calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  transition-delay: calc(var(--i)*.025s);
}

.uv-cbento:hover .bars i {
  height: calc(var(--h) * .7 + 25%);
  background: linear-gradient(var(--c2),var(--c1));
}

.uv-cbento footer {
  display: flex;
  gap: .5em;
  margin-top: 1em;
  font-size: .72em;
}

.uv-cbento footer b {
  color: #30a46c;
}

.uv-cbento footer span {
  opacity: .5;
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uv-cbento {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 17em;
  padding: 1.3em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 18px 50px -35px #000;
}

.uv-cbento header {
  display: flex;
  gap: .8em;
  align-items: center;
}

.uv-cbento header>span {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: .75em;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uv-cbento small {
  opacity: .48;
}

.uv-cbento h3 {
  margin: .12em 0;
  font-size: .95em;
}

.uv-cbento strong {
  display: block;
  margin: .6em 0 .25em;
  font-size: 3em;
  font-weight: 500;
}

.uv-cbento sup {
  font-size: .42em;
}

.uv-cbento .bars {
  height: 5em;
  display: flex;
  align-items: end;
  gap: .3em;
}

.uv-cbento .bars i {
  flex: 1;
  height: var(--h);
  border-radius: 999px;
  background: color-mix(in srgb,var(--c1) 20%,transparent);
  transform-origin: bottom;
  transition: all calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  transition-delay: calc(var(--i)*.025s);
}

.uv-cbento:hover .bars i {
  height: calc(var(--h) * .7 + 25%);
  background: linear-gradient(var(--c2),var(--c1));
}

.uv-cbento footer {
  display: flex;
  gap: .5em;
  margin-top: 1em;
  font-size: .72em;
}

.uv-cbento footer b {
  color: #30a46c;
}

.uv-cbento footer span {
  opacity: .5;
}
`;

export default function CardBento() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uv-cbento"><header><span>↗</span><div><small>This week</small><h3>Performance</h3></div></header><strong>84<sup>%</sup></strong><div className="bars"><i style={{ "--h": "30%", "--i": "0" } as CSSProperties}></i><i style={{ "--h": "47%", "--i": "1" } as CSSProperties}></i><i style={{ "--h": "64%", "--i": "2" } as CSSProperties}></i><i style={{ "--h": "81%", "--i": "3" } as CSSProperties}></i><i style={{ "--h": "33%", "--i": "4" } as CSSProperties}></i><i style={{ "--h": "50%", "--i": "5" } as CSSProperties}></i><i style={{ "--h": "67%", "--i": "6" } as CSSProperties}></i><i style={{ "--h": "84%", "--i": "7" } as CSSProperties}></i><i style={{ "--h": "36%", "--i": "8" } as CSSProperties}></i><i style={{ "--h": "53%", "--i": "9" } as CSSProperties}></i><i style={{ "--h": "70%", "--i": "10" } as CSSProperties}></i><i style={{ "--h": "87%", "--i": "11" } as CSSProperties}></i></div><footer><b>+12.4%</b><span>vs. last week</span></footer></article>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Bento metric card” block (Cards) from AIMRAN Library to my project.

## What it is
A compact stat card: one big number and a row of bars that rise one by one on hover.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Performance"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import type { CSSProperties } from "react";

const css = `
.uv-cbento {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 17em;
  padding: 1.3em;
  border-radius: 1.5em;
  font-size: var(--s);
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 18px 50px -35px #000;
}

.uv-cbento header {
  display: flex;
  gap: .8em;
  align-items: center;
}

.uv-cbento header>span {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: .75em;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uv-cbento small {
  opacity: .48;
}

.uv-cbento h3 {
  margin: .12em 0;
  font-size: .95em;
}

.uv-cbento strong {
  display: block;
  margin: .6em 0 .25em;
  font-size: 3em;
  font-weight: 500;
}

.uv-cbento sup {
  font-size: .42em;
}

.uv-cbento .bars {
  height: 5em;
  display: flex;
  align-items: end;
  gap: .3em;
}

.uv-cbento .bars i {
  flex: 1;
  height: var(--h);
  border-radius: 999px;
  background: color-mix(in srgb,var(--c1) 20%,transparent);
  transform-origin: bottom;
  transition: all calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  transition-delay: calc(var(--i)*.025s);
}

.uv-cbento:hover .bars i {
  height: calc(var(--h) * .7 + 25%);
  background: linear-gradient(var(--c2),var(--c1));
}

.uv-cbento footer {
  display: flex;
  gap: .5em;
  margin-top: 1em;
  font-size: .72em;
}

.uv-cbento footer b {
  color: #30a46c;
}

.uv-cbento footer span {
  opacity: .5;
}
`;

export default function CardBento() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uv-cbento"><header><span>↗</span><div><small>This week</small><h3>Performance</h3></div></header><strong>84<sup>%</sup></strong><div className="bars"><i style={{ "--h": "30%", "--i": "0" } as CSSProperties}></i><i style={{ "--h": "47%", "--i": "1" } as CSSProperties}></i><i style={{ "--h": "64%", "--i": "2" } as CSSProperties}></i><i style={{ "--h": "81%", "--i": "3" } as CSSProperties}></i><i style={{ "--h": "33%", "--i": "4" } as CSSProperties}></i><i style={{ "--h": "50%", "--i": "5" } as CSSProperties}></i><i style={{ "--h": "67%", "--i": "6" } as CSSProperties}></i><i style={{ "--h": "84%", "--i": "7" } as CSSProperties}></i><i style={{ "--h": "36%", "--i": "8" } as CSSProperties}></i><i style={{ "--h": "53%", "--i": "9" } as CSSProperties}></i><i style={{ "--h": "70%", "--i": "10" } as CSSProperties}></i><i style={{ "--h": "87%", "--i": "11" } as CSSProperties}></i></div><footer><b>+12.4%</b><span>vs. last week</span></footer></article>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
