@molecule/app-comparison-row-solid

Feature · comparison-row · App (browser) · v1.1.3 · Apache-2.0

Period-over-period stat comparison ("$X vs $Y", with delta)

npm install @molecule/app-comparison-row-solid

npm · Source on GitHub

How it works

@molecule/app-comparison-row-solid is a ready-made comparison-row feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { ComparisonRow } from '@molecule/app-comparison-row-solid'

export function Stats() {
  return (
    <ComparisonRow
      label="Revenue"
      current="$24,800"
      previous="$21,300"
      deltaPct={16.4}
      periodLabel="vs. last month"
    />
  )
}

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid period-over-period stat comparison row — the Solid counterpart of @molecule/app-comparison-row-react, with the same props and the same DOM for the same input.

Exports ComparisonRow: current value, optional previous value, and a coloured delta% chip for dashboards, report summaries and finance overviews.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { ComparisonRow } from '@molecule/app-comparison-row-solid'

export function Stats() {
  return (
    <ComparisonRow
      label="Revenue"
      current="$24,800"
      previous="$21,300"
      deltaPct={16.4}
      periodLabel="vs. last month"
    />
  )
}

Type

feature

Installation

npm install @molecule/app-comparison-row-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

ComparisonRowProps

Props accepted by the ComparisonRow component.

interface ComparisonRowProps {
  /** Label for the metric (e.g. "Revenue"). */
  label: JSX.Element
  /** Current period value (formatted). */
  current: JSX.Element
  /** Previous period value (formatted). */
  previous?: JSX.Element
  /** Numeric delta% — drives direction + color when present. */
  deltaPct?: number
  /** Custom delta formatter. */
  formatDelta?: (deltaPct: number) => JSX.Element
  /** Optional sub-text ("vs. last week"). */
  periodLabel?: JSX.Element
  /** Extra classes. */
  className?: string
}

Functions

ComparisonRow(props)

Period-over-period stat comparison row — current value, optional previous value, and a coloured delta% chip. Used in dashboards, report summaries, finance overviews.

function ComparisonRow(props: ComparisonRowProps): JSX.Element
  • props — Component props (see ComparisonRowProps).

Returns: The rendered comparison row.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.4.0
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid
  • @molecule/app-ui
  • @molecule/app-ui-solid
  • solid-js

The delta chip colors by SIGN with fixed semantics: positive = green, negative = red (hardcoded hexes applied inline, not theme tokens). There is no "down-is-good" inversion — for metrics like churn or costs, negate deltaPct (and restate the sign in formatDelta, which controls the text only, never the color). label / current / previous / periodLabel are consumer-provided nodes — pass pre-formatted, translated values.