Ir al contenido

UsageBar

Cuánto del límite de un plan se usa: «7,2 GB de 8 GB». Cerca del límite dice qué pasará y ofrece el siguiente paso antes de llegar.

import { UsageBar } from '@sypnia/ui/react'

En esta página
  1. Los límites de un plan
  2. Cuándo usarlo
  3. Para todos
  4. Props

Los límites de un plan

Rows120.400 de 500.000
Storage6,7 GB de 7,5 GB
90 % usado: pronto estará lleno.See larger plans
Emails this month10.000 de 10.000
Se llegó al límite: los datos nuevos no se guardan.Vuelve a empezar el 1 dic 2026Move to Pro
Código
import { LinkButton, UsageBar, useSypnia } from '@sypnia/ui/react';

// The limits of a plan. Near the limit it says so and offers the next step.
export default function Plan() {
  const { format } = useSypnia();
  const gb = (v: number) => format.bytes(v * 1e9);
  return (
    <div className="sy-stack">
      <UsageBar label="Rows" used={120_400} limit={500_000} />
      <UsageBar label="Storage" used={7.2} limit={8} format={gb} action={<LinkButton href="#plans" size="sm">See larger plans</LinkButton>} />
      <UsageBar label="Emails this month" used={10_000} limit={10_000} resetsAt="2026-12-01" action={<LinkButton href="#plans" size="sm" variant="primary">Move to Pro</LinkButton>} />
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Páginas de facturación y plan, y el resumen de un proyecto.
  • Pasa action con un enlace a los planes, y resetsAt para límites mensuales.

No lo uses cuando

  • Medidas sin un plan detrás: usa Meter.

Para todos

  • Es un meter; el aviso cerca del límite se dice en palabras.

Props

UsageBarTipoPor defecto
labelobligatorio ReactNode
limitobligatorio number
usedobligatorio number
action

The next step, shown from 80 %: usually a LinkButton to the plans.

ReactNode
format

How amounts are written: bytes, rows, requests. Defaults to a number.

((v: number) => string)
loading

The amount is on its way: the label stays, the amount and the bar are skeletons. Pass the last known `used` and `limit`, so the amount's bar is as long as its words will be.

boolean
resetsAt

When the count starts again, for monthly limits.

string | number | Date
  1. Los límites de un plan
  2. Cuándo usarlo
  3. Para todos
  4. Props

    Busca páginas, secciones y términos