npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@microsoft/fabric-visuals-web-components

v5.4.0

Published

Vega-Lite visualization web component for Fabric Apps - Analytics

Readme

@microsoft/fabric-visuals-web-components

Framework-agnostic Web Component for the Fabric Apps - Analytics Vega-Lite visualization system. This package wraps the React VegaVisual component as a standard custom element (<fabric-vega-visual>), bundling React internally so consumers do not need a React dependency.

For the DataGrid web component, see @microsoft/fabric-datagrid-web-components.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Installation

npm install @microsoft/fabric-visuals-web-components

Sibling dependency

  • @microsoft/fabric-visuals-core — provides DataTable, ColumnDef, VisualTheme, and design tokens consumed by properties of this component.

Note: React and ReactDOM are bundled internally — you do not need to install them.

Architecture

@microsoft/fabric-visuals-core           (framework-agnostic types & tokens)
        ↓
@microsoft/fabric-visuals                (React VegaVisual component)
        ↓
@microsoft/fabric-visuals-web-components (this package — wraps React as a custom element)
        ↓
@microsoft/fabric-visuals-angular        (optional Angular wrapper)

Quick Start

<script type="module">
  import { registerFabricVegaVisual } from '@microsoft/fabric-visuals-web-components';

  // Register the <fabric-vega-visual> custom element (idempotent)
  registerFabricVegaVisual();

  const el = document.querySelector('fabric-vega-visual');
  el.spec = {
    $schema: 'https://vega.github.io/schema/vega-lite/v6.json',
    mark: 'bar',
    encoding: {
      x: { field: 'city', type: 'nominal' },
      y: { field: 'pop', type: 'quantitative' },
    },
  };
  el.theme = {
    foreground: '#111',
    foregroundSecondary: '#444',
    brandForeground: '#0078d4',
    brandBackground: '#0078d4',
    background: '#fff',
    backgroundSecondary: '#f5f5f5',
    backgroundHover: '#e8e8e8',
    stroke: '#d0d0d0',
  };
  el.data = {
    columns: [
      { name: 'city', displayName: 'City' },
      { name: 'pop', displayName: 'Population' },
    ],
    rows: [
      ['New York', 8336817],
      ['London', 8982000],
    ],
  };
</script>

<fabric-vega-visual style="height: 400px"></fabric-vega-visual>

Public API

All exports come from the package entry point:


registerFabricVegaVisual(tagName?)

Registers the custom element with the browser. Must be called before using <fabric-vega-visual> in the DOM.

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | tagName | string | 'fabric-vega-visual' | Custom element tag name. Override to avoid conflicts. |

Returns: true if registration occurred, false if the tag was already registered to this class.

Throws: If the tag is already registered to a different constructor.


FabricVegaVisualElement

The custom element class (extends HTMLElement). Properties are set as JavaScript object properties — not HTML attributes — because they carry complex data.

Properties

| Property | Type | Required | Description | |----------|------|----------|-------------| | spec | VisualizationSpec \| string | yes | A Vega-Lite spec object or a JSON string. | | theme | VisualTheme | yes | Semantic color theme from @microsoft/fabric-visuals-core. | | data | DataTable \| Record<string, DataTable> \| null | no | One table or named datasets. | | selections | readonly SemanticSelection[] | no | Accepted source selection; omitted is local, [] is controlled and cleared. | | selectableFields | readonly string[] | no | Raw identity fields, including eligible hidden keys. | | groupOnKeys | Readonly<Record<string, readonly string[]>> | no | Key fields by field ID. With managed selections, a text value shared by more than one key is shown with a suffix. | | isCrossHighlightActive | boolean | no | The highlight flag paired with the displayed datasets. | | configVegaLite | VegaLiteConfig | no | Custom Vega-Lite configuration merged with the built-in base theme. | | capabilities | VegaVisualCapabilities | no | Compilation and rendering options. | | header | HeaderProps | no | Title and optional subtitle: { title, subtitle? }. | | visualContainerCapabilities | VisualContainerCapabilities | no | Copy is enabled by default; opt out with { allowCopyVisual: false }. | | chromeless | boolean | no | Removes all framing when true. Defaults to false. | | containerRootClassName | string | no | CSS class for the internal React frame's outer root, not this custom element. Apply dashboard grid/flex placement to the host element itself. | | containerClassName | string | no | CSS class for the inner card surface: background, border, radius and padding. | | view | View \| null | — | Read-only. The current Vega View instance, or null if not rendered. |

Reassign framing properties to update; set them to undefined to restore defaults.

Replace capabilities to update options; omitted keys restore defaults.

Events

| Event | Type | Description | |-------|------|-------------| | vegaevent | CustomEvent<VegaVisualEventDetail> | Fired for all visualization lifecycle events (render, error, vega, specUpdate). Bubbles and is composed. |

el.addEventListener('vegaevent', (e) => {
  console.log(e.detail.type, e.detail.message);
});

Re-exported Types

  • VisualizationSpec, VegaLiteConfig, VegaVisualCapabilities, VegaVisualEventDetail, VegaVisualEventType, VegaVisualEventLevel, VegaVisualEventCallback, VegaVisualProps, VegaVisualHandle, LogLevelName
  • HeaderProps, VisualContainerCapabilities, VisualFramingProps

Re-exported Utilities

| Function | Description | |----------|-------------| | registerVbaFormatter() | Registers the vbaFormat custom format type with Vega. Idempotent. | | LOG_LEVEL_MAP | Maps friendly names to Vega numeric log level constants. |


Using with Angular

For Angular applications, use the @microsoft/fabric-visuals-angular package which provides a thin Angular wrapper (<fabric-vega-visual-ng>) with @Input/@Output bindings. See its README for details.