imfemambocus

Figure

Component

About

A numeric display for data tables that dims the decimal portion of a value, shows a tick mark for zero/missing values, and underlines a value that falls below a threshold.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Figure to your project and fits it to your theme.

Code

How Figure is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import type { ReactNode } from "react";
import { Elapsed, Figure } from "@/components/ui/figure";

interface RowProps {
  readonly label: string;
  readonly children: ReactNode;
}

const Row = ({ label, children }: RowProps) => (
  <div className="flex items-baseline justify-between gap-8 border-b border-reed/60 py-1.5">
    <span className="text-weft-dim">{label}</span>
    <span className="tnum font-data text-weft">{children}</span>
  </div>
);

export default function FigureDemo() {
  return (
    <div className="layer flex w-full max-w-sm flex-col p-6">
      <Row label="Reads (M)">
        <Figure value={412.8} />
      </Row>
      <Row label="Q30 (%)">
        <Figure value={94.2} />
      </Row>
      <Row label="Q30 (%), under 80">
        <Figure value={62.7} low />
      </Row>
      <Row label="Coverage (x), none yet">
        <Figure value={0} />
      </Row>
      <Row label="Elapsed">
        <Elapsed minutes={401} />
      </Row>
    </div>
  );
}

More by imfemambocus

View all
  • Select

    Select