Interactive example
Opportunity mapSynthetic scores. Point area represents confidence.
Use arrow keys to select a data point. Home selects the first point and End selects the last. Escape closes the value tooltip.
Atlas
Effort score
2.4
Impact score
63
confidence
42
View data table 6 rows
Opportunity map
Data pointEffort scoreImpact scoreconfidence
Atlas2.46342
Boreal4.17861
Cedar3.25435
Dune5.38674
Elm1.84728
Fjord4.76957

Installation

terminal
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/scatter-chart.json

The registry includes the shared styles and dependencies. Import @/components/apple-ui/styles.css in your root layout once. For the package route, use the installation guide.

Usage

tsx
"use client";

import { ScatterChart } from "@eduardoul/apple-ui";

const data = [
  { label: "Atlas", effort: 2.4, impact: 63, confidence: 42 },
  { label: "Boreal", effort: 4.1, impact: 78, confidence: 61 },
  { label: "Cedar", effort: 3.2, impact: 54, confidence: 35 },
  { label: "Dune", effort: 5.3, impact: 86, confidence: 74 },
];

export function Example() {
  return (
    <ScatterChart
      title="Opportunity map"
      description="Synthetic scores. Point area represents confidence."
      data={data}
      xKey="effort"
      yKey="impact"
      sizeKey="confidence"
      xLabel="Effort score"
      yLabel="Impact score"
    />
  );
}

Package imports use @eduardoul/apple-ui. Registry imports use @/components/apple-ui. Add "use client" to files that use state or event handlers.

API reference

PropertyTypeDefault
dataChartDatum[]required
xKeystringx
yKeystringy
sizeKeystringundefined
labelKeystringlabel
xLabelstringX
yLabelstringY
titlestringrequired
descriptionstringundefined
heightnumbercomponent default
loadingbooleanfalse
errorstringundefined
emptyMessagestringNo data to display.
showTablebooleantrue
compactbooleanfalse
valueFormatter(value: number) => stringlocalized number
classNamestringundefined
styleReact.CSSPropertiesundefined

Use className and style to customize the component. The package includes full TypeScript definitions for its supported element properties and refs.

Design guidance

  • Use a scatter chart when the relationship between two measures is the question.
  • Name both axes with the measure and unit. A point position is meaningless without that context.
  • Use point size for a third measure only when it adds a clear decision signal.
  • Every coordinate must be finite. Optional point sizes must also be finite and cannot be negative.
Read Apple’s guidance

Accessibility

Give the chart a descriptive title and explain its units. Select a data point to read its values, or open the data table for the full dataset. Labels and values accompany color, and the chart adapts to reduced motion and appearance preferences. Test long labels, touch input and keyboard navigation with your own data.

Library styles support reduced motion, reduced transparency, increased contrast and forced colors. Read the accessibility foundation for the checks your application still needs.