# Metric switch bar chart

https://fieldbook.lizardi.mx/components/metric-switch-bar-chart

Category: Charts
![Still of the Metric switch bar chart component, a Fieldbook UI component in Charts.](https://fieldbook.lizardi.mx/thumbs/metric-switch-bar-chart.webp)
Preview video: https://ejpqcxcjbiyabxkx.public.blob.vercel-storage.com/previews/metric-switch-bar-chart-05a00a3ff1.mp4 (5 s, silent)

Metric switch bar chart: A dense daily bar chart with two metric tiles in the header; clicking a tile morphs the bars over to that metric.

## Frameworks

react, vue, svelte, astro, html

## Preview controls

These controls are passed to the demo. Defaults and limits describe the preview; consult the implementation for its full prop API.

| Name | Type | Default | Options or constraints |
| --- | --- | --- | --- |
| accentColor | color | #FF6A1F | No additional limit in the metadata. |
| secondColor | color | #38BDF8 | No additional limit in the metadata. |
| days | number | 90 | From 30 to 120; step 10 |
| defaultMetric | select | visits | Options: visits, signups |
| animate | boolean | true | No additional limit in the metadata. |

## Usage notes

Metric switch bar chart uses the wide preview frame with a light/dark theme setting.

### Which frameworks are available for Metric switch bar chart?

Metric switch bar chart is available for React, Vue, Svelte, Astro, HTML. The live preview uses React; the source observations below apply to index.tsx. Check the selected port before relying on the same interactions.

### What does Metric switch bar chart depend on?

The React metadata lists these npm dependencies beyond React: motion, clsx, tailwind-merge.

### What accessibility details are visible in Metric switch bar chart?

The React source for Metric switch bar chart includes: native elements (button); attributes and handlers (aria-hidden, aria-label, aria-pressed, onKeyDown, tabIndex); explicit roles (img); key comparisons (ArrowLeft, ArrowRight, End, Escape, Home). These are source observations. Verify accessible names, focus order and keyboard behavior in the composed page.

### How does Metric switch bar chart handle reduced motion?

Metric switch bar chart reads the motion preference in its React source through useReducedMotion(). Preference-dependent expressions in index.tsx: barTransition: reduce \|\| !animate ? \{ duration: 0 \} : \{ duration: 0.55, ease: \[0.22, 1, 0.36, 1\] \}; reduce ? \{ duration: 0 \} : \{ type: "spring", stiffness: 380, damping: 36 \}. Check the full implementation, shared styles and selected port with reduced motion enabled; these observations do not establish that every animation stops.

## Install through MCP

Connect your client, call get_component to retrieve the implementation, then get_install_command for installation instructions. Choose a listed framework, integrate the returned source and verify it in your application.

```json
{
  "tool": "get_component",
  "arguments": {
    "slug": "metric-switch-bar-chart",
    "framework": "react"
  }
}
```

[For agents](https://fieldbook.lizardi.mx/docs/agents)
[MCP](https://fieldbook.lizardi.mx/api/mcp)

## Related open components

- [Range filter area chart](https://fieldbook.lizardi.mx/components/range-filter-area-chart)
- [Donut with total](https://fieldbook.lizardi.mx/components/donut-with-total)
- [Highlighted bar chart](https://fieldbook.lizardi.mx/components/highlighted-bar-chart)
- [Inline labeled bar chart](https://fieldbook.lizardi.mx/components/inline-labeled-bar-chart)
- [Paired bar chart](https://fieldbook.lizardi.mx/components/paired-bar-chart)
- [Series icon area chart](https://fieldbook.lizardi.mx/components/series-icon-area-chart)
