Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

8.0 KB
Raw Blame

@metabase/custom-viz changelog

This changelog covers the @metabase/custom-viz npm package — the API and CLI for building custom visualizations for Metabase. Changes to how Metabase itself hosts custom visualization plugins are covered by the Metabase changelog.

2.0.1

Bug Fixes

  • Security: updated Vite in scaffolded projects from 8.0.16 to 8.1.6 to pick up upstream security fixes (#85837).
  • The scaffolded dev server no longer crashes when an asset file disappears before it's copied, which happened with editors that save through atomic writes, or when a directory is added to public/assets. One save now triggers a single reload. Assets deleted from public/assets are now removed from dist/assets too (#83597).

Fix the asset watcher in existing projects

After upgrading, copy the new config from the package:

cp node_modules/@metabase/custom-viz/dist/templates/vite.config.ts vite.config.ts

If you've customized vite.config.ts, port the syncAssets function and the watch(assetsDirSrc, ...) callback from that file instead.

2.0.0

⚠ BREAKING CHANGES

  • column and column_settings are now reserved setting ids, contributed to every visualization by Metabase to power the built-in per-column formatting popover. Plugins that declared their own settings under these ids must rename them — the Settings type now rejects those keys with a type error (#78128).
  • Plugin settings are now stored under custom:<plugin name>:<setting id> keys in a question's visualization_settings, so a plugin can never write one of Metabase's own settings. Plugins keep using their own ids: settings, onChangeSettings, readDependencies, writeDependencies, and eraseDependencies are translated by Metabase and refer to the plugin's own settings only (#81181).
  • onChangeSettings and the dependency lists are typed to the plugin's own setting ids. Writes to Metabase settings such as card.title or click_behavior no longer take effect (#81181).
  • Plugin settings saved by earlier plugin versions are adopted under the new keys automatically. Metabase settings an earlier plugin version already wrote, including click_behavior, stay stored and keep taking effect until removed, so review click behavior on existing custom visualization cards (#81181).
  • ClickObject is no longer generic and no longer has a settings field. Metabase attaches the visualization's current settings to every click itself and ignores anything passed under settings, so a click can't redirect dashboard click behavior. A click_behavior saved by an earlier plugin version stays in effect until removed (#81181).
  • The top-level colorScheme visualization prop moved into the new renderingContext prop (see Features below). Read props.renderingContext.colorScheme instead of props.colorScheme (#78429).
  • The id field of the visualization definition is removed. It was never read — Metabase identifies a visualization by name in metabase-plugin.json. Delete it from your defineConfig call.
  • The module-level measureText, measureTextWidth, and measureTextHeight exports are removed. The functions were stubs that always returned zero-size measurements — for real ones, use measureText on the new renderingContext prop (see Features below) (#78429).

Features

  • Per-column formatting: visualization settings now include a column function that resolves a column's effective formatting settings — instance-wide defaults, the column's metadata settings, and the card-level settings from the column formatting popover, merged in that order. Pass its result to formatValue to render values the way the user configured them (#78128).
  • New renderingContext visualization prop with host rendering helpers: getColor resolves a Metabase color name to its current theme value, measureText measures text the way Metabase renders it, returning { width, height } from a single measurement (style.family defaults to the instance font), fontFamily exposes that font for styling your own markup, and colorScheme tells you whether Metabase is rendering in light or dark mode (#78429).
  • New @metabase/custom-viz pack command packages a built visualization into an upload-ready .tgz. Scaffolded projects call it from their build script instead of carrying their own copy of the packaging script, so fixes to packaging and to the bundle size limits now come with a package upgrade. Pass --dir to pack a project in another directory.
  • @metabase/custom-viz pack stamps the exact @metabase/custom-viz version into the packed manifest as sdk.version. Your source metabase-plugin.json is not modified. Metabase compares the stamp against the SDK versions it was tested with — a plugin outside that range (or outside its own metabase.version range) is never rejected; it uploads and runs normally, with a warning shown on the admin page.
  • getName is now optional and is what Metabase shows as the visualization name in the UI. Omit it to use name from metabase-plugin.json; keep it to show a localized or human-friendly name.
  • checkRenderable is now optional. Omit it when your visualization can render any data; keep throwing from it to surface a custom error. A visualization without a checkRenderable is always considered renderable (#81181).

Bug Fixes

  • FormatValueOptions["date_style"] now accepts null, matching the values Metabase actually passes (#70306).

Migrate to the pack command

Projects scaffolded before 2.0.0 have their own pack.mjs at the project root. To switch to the CLI:

  1. Update @metabase/custom-viz to 2.0.0 or newer.

  2. Change the build script in package.json to:

    vite build && metabase-custom-viz pack
    
  3. Delete pack.mjs.

  4. Remove tar-stream and @types/tar-stream from devDependencies, then reinstall.

Run npm run build to confirm you still get a <name>-<version>.tgz at the project root.

1.0.5 (2026-07-23)

Bug Fixes

  • The .gitignore in scaffolded projects now ignores dist/ and *.tgz (#78355).

Documentation

  • Updates to the scaffolded project's README (#75332, #78355).

1.0.4 (2026-06-03)

Features

  • Custom React components as setting widgets: a setting definition's widget now accepts a React.ComponentType in addition to the built-in widget names, and getProps is typed to return the component's own props (minus the base props injected by the settings renderer) (#73941).

1.0.3 (2026-06-02)

Bug Fixes

  • Security: updated Vite in scaffolded projects from 8.0.0 to 8.0.16 to pick up upstream security fixes (#75053).

1.0.2 (2026-06-01)

⚠ BREAKING CHANGES

  • Removed getAssetUrl from the visualization component props (CreateCustomVisualizationProps) — inline images and other static assets into your plugin code e.g. using base64 strings (#74960).

1.0.1 (2026-05-15)

⚠ BREAKING CHANGES

  • Replaced section?: string with getSection?: () => string in setting definitions, so section labels can be localized at call time (#74077).

1.0.0 (2026-05-08)

  • Initial stable release.