Interactive example
Requests and completed requestsSynthetic monthly counts
  • Requests
  • Completed requests
Use arrow keys to select a data point. Home selects the first point and End selects the last. Escape closes the value tooltip.
Jan
Requests
42
Completed requests
31
View data table 6 rows
Requests and completed requests
Data pointRequestsCompleted requests
Jan4231
Feb5846
Mar5143
Apr6755
May7361
Jun7868

Installation

terminal
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/composed-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 { ComposedChart } from "@eduardoul/apple-ui";

const data = [
  { label: "Jan", requests: 42, completed: 31 },
  { label: "Feb", requests: 58, completed: 46 },
  { label: "Mar", requests: 51, completed: 43 },
  { label: "Apr", requests: 67, completed: 55 },
  { label: "May", requests: 73, completed: 61 },
];

export function Example() {
  return (
    <ComposedChart
      title="Requests and completed requests"
      description="Synthetic monthly counts"
      data={data}
      series={[
        { key: "requests", label: "Requests" },
        { key: "completed", label: "Completed requests" },
      ]}
    />
  );
}

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
seriesChartSeries[]required
labelKeystringlabel
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 the first series for bars and the remaining series for lines.
  • Compose measures only when one shared scale makes both readable and honest.
  • Split the view when units or ranges differ enough that one series would appear flat or exaggerated.
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.