# ROI calculator

Compare explicit time-value assumptions with consumer-calculated costs and returns.

Access: pro. Category: Marketing. Kind: composite.

## When to use

- Use it when a page needs compare explicit time-value assumptions with consumer-calculated costs and returns.
- Choose it as the social-proof region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose feature-card instead when a feature summary with animated orbital artwork is the actual interface need, rather than roi calculator.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install ROI calculator

```sh
npx shadcn@latest add @tidal-pro/roi-calculator
```

Stylesheets: `components/ui/tidal.css`, `components/ui/roi-calculator.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/roi-calculator.css";
import{TidalRoiCalculator}from"./components/ui/roi-calculator";
export default()=><div className="tidal-scope"><TidalRoiCalculator disclaimer={"value"} formula={"value"} inputs={[{id:"example",label:"Demo"}]} onValueChange={() => {}} results={[{id:"example",label:"Demo",value:1}]} title={"Demo"} values={{}}/></div>;
```

## Structured props

- `TidalRoiCalculator.disclaimer: ReactNode`: Required disclaimer value accepted by this exported component.
- `TidalRoiCalculator.formula: ReactNode`: Required formula value accepted by this exported component.
- `TidalRoiCalculator.inputs: ReadonlyArray<TidalRoiInput>`: Required inputs value accepted by this exported component.
- `TidalRoiCalculator.onValueChange: (id: string, value: number | null) => void`: Callback invoked when the value change interaction is proposed.
- `TidalRoiCalculator.results: ReadonlyArray<TidalRoiResult>`: Required results value accepted by this exported component.
- `TidalRoiCalculator.title: ReactNode`: Required title value accepted by this exported component.
- `TidalRoiCalculator.values: Readonly<Record<string, number | null>>`: Required values value accepted by this exported component.
- `TidalRoiCalculator.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalRoiCalculator.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalRoiCalculator.errors?: Readonly<Record<string, string | undefined>> | undefined` (default {}): Optional errors value accepted by this exported component.
- `TidalRoiCalculator.inputProps?: ((input: TidalRoiInput) => InputProps) | undefined`: Optional input props value accepted by this exported component.
- `TidalRoiCalculator.inputRefs?: Readonly<Record<string, Ref<HTMLInputElement>>> | undefined`: Optional input refs value accepted by this exported component.
- `TidalRoiCalculator.labels?: Partial<{ reset: string; assumptions: string; results: string; formula: string; incomplete: string; invalid: string; }> | undefined` (default {}): Optional labels value accepted by this exported component.
- `TidalRoiCalculator.onReset?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the reset interaction is proposed.
- `TidalRoiCalculator.resetProps?: ResetProps | undefined` (default {}): Optional reset props value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/roi-calculator.tsx) | [Manifest](https://tidalui.com/examples/roi-calculator.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { TidalRoiCalculator, type TidalRoiInput } from "./components/ui/roi-calculator";

import "./components/ui/roi-calculator.css";

import "./components/ui/number-stepper.css";



const tidalExampleStyles = ".tidal-scope .roi-calculator-demo {\n  width: 100%;\n  max-width: 940px;\n  min-width: 0;\n}\n.roi-calculator-demo .tidal-roi-formula p {\n  margin: 6px 0 0;\n}\n@media (max-width: 400px) {\n  .roi-calculator-demo .tidal-roi {\n    padding: 18px;\n  }\n}";

const initial = { people: 8, hours: 3, rate: 45, subscription: 240 };

export const roiInputs: readonly TidalRoiInput[] = [
  {
    id: "people",
    label: "People using the product",
    min: 1,
    max: 500,
    step: 1,
    unit: "people",
  },
  {
    id: "hours",
    label: "Time saved each week",
    description: "Per person, based on your own estimate.",
    min: 0,
    max: 40,
    step: 0.5,
    unit: "hours",
  },
  {
    id: "rate",
    label: "Value of one hour",
    min: 1,
    max: 500,
    step: 1,
    unit: "USD",
  },
  {
    id: "subscription",
    label: "Monthly product cost",
    min: 1,
    max: 50000,
    step: 1,
    unit: "USD",
  },
];

export function RoiCalculatorDemo() {
  const [values, setValues] = useState<Record<string, number | null>>(initial);
  const complete = Object.values(values).every((v) => v !== null);
  const monthly = complete
    ? (values.people! * values.hours! * values.rate! * 52) / 12
    : null;
  const net = monthly === null ? null : monthly - values.subscription!;
  const roi =
    net === null || !values.subscription || values.subscription <= 0
      ? null
      : (net / values.subscription) * 100;
  const money = (v: number) =>
    new Intl.NumberFormat("en-US", {
      style: "currency",
      currency: "USD",
      maximumFractionDigits: 0,
    }).format(v);
  return (
    <div className="roi-calculator-demo">
      <TidalRoiCalculator
        title="Estimate the value of time saved"
        description="Adjust four assumptions to compare time value with a monthly product cost."
        inputs={roiInputs}
        values={values}
        onValueChange={(id, value) => setValues((v) => ({ ...v, [id]: value }))}
        inputProps={(i) => ({ name: i.id })}
        results={[
          {
            id: "net",
            label: "Estimated monthly net value",
            value: net,
            formatValue: money,
            description: "Time value less the product cost.",
          },
          {
            id: "roi",
            label: "Estimated return on cost",
            value: roi,
            formatValue: (v) => `${Math.round(v).toLocaleString("en-US")}%`,
          },
        ]}
        formula={
          <>
            <p>
              Monthly time value = people × weekly hours saved × hourly value ×
              52 ÷ 12.
            </p>
            <p>
              Net value = monthly time value − monthly cost. Return = net value
              ÷ monthly cost × 100.
            </p>
          </>
        }
        disclaimer="Illustrative estimates only. Time saved is not cash earned, and actual results depend on your assumptions."
        onReset={() => setValues(initial)}
      />
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <RoiCalculatorDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned numeric assumptions and exact supplied results. Up to 12 unique inputs and 8 unique result IDs. Finite values, explicit min/max/step, missing values and validation errors are checked before results display. Results are never calculated or inferred by the component. Accepted Number stepper provides native input, keyboard and form behavior; input names/form refs and direct input refs are preserved. Optional reset is caller-first and preventable. Native root attrs/ref with React 19 cleanup, disabled state, source/body focus recovery, formula disclosure, explicit disclaimer, responsive stacking, 44px controls, 16px phone fields, RTL and reduced motion. The illustrative demo computes the displayed formulas locally and is not a prediction, financial recommendation, saving guarantee or real submission.
