vue3-apexcharts is the official Vue 3 wrapper component for ApexCharts.js, a modern open-source charting library used for building interactive data visualizations. Currently at version 1.11.1, it provides seamless integration of ApexCharts within Vue 3 applications, offering features like reactive chart updates where changes to data or options automatically re-render the chart. The library supports tree-shaking, allowing developers to import only necessary chart types to optimize bundle size, and includes robust Server-Side Rendering (SSR) capabilities with dedicated `<apexchart-server>` and `<apexchart-hydrate>` components. It also offers full TypeScript support, enhancing developer experience with type safety. This package is specifically designed for Vue 3; users requiring Vue 2 compatibility should instead use the `vue-apexcharts` package. The release cadence typically follows updates to the core ApexCharts.js library, ensuring compatibility and access to new features. Its key differentiator is being the official, fully-featured, and actively maintained Vue 3 component for ApexCharts.js.
npm install vue3-apexchartsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a reactive bar chart using `vue3-apexcharts`, configure its data and options, and dynamically update the chart series when a button is clicked. It includes both local component registration and TypeScript type declaration for the global `$apexcharts` property, making it ready for a modern Vue 3 setup.
For Vue 2.x applications, use the `vue-apexcharts` package instead. Ensure your project's `vue` dependency is `^3.0.0` or higher.
Install `apexcharts` alongside `vue3-apexcharts`: `npm install apexcharts vue3-apexcharts` or `yarn add apexcharts vue3-apexcharts`.
Ensure `app.use(VueApexCharts)` is executed directly after `createApp(App)` in your `main.ts`/`main.js` file, or explicitly add `apexchart: VueApexCharts` to the `components` property of any Vue component using it.
Add the following declaration to a `.d.ts` file or directly in your `main.ts` after importing `ApexCharts`:
```typescript
import ApexCharts from "apexcharts";
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$apexcharts: typeof ApexCharts;
}
}
```If using globally, ensure `import VueApexCharts from "vue3-apexcharts"; createApp(App).use(VueApexCharts).mount('#app');` is called. If locally, add `components: { apexchart: VueApexCharts }` to your component's definition.Install `apexcharts` as a peer dependency: `npm install apexcharts` or `yarn add apexcharts`.
Add the provided `declare module "@vue/runtime-core" {...}` block to your TypeScript environment (e.g., in `shims-vue.d.ts` or `main.ts`) after importing `ApexCharts`.