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-core

v5.4.0

Published

Core library for Fabric Apps - Analytics — data utilities, design tokens, and configuration

Readme

@microsoft/fabric-visuals-core

The fabric-visuals-core package is a foundational component of the "Fabric visualization components" ecosystem. It defines the common contracts and helpers, such as foundational shared types, data utilities, format helpers, localization scaffolding, and design tokens for sibling components:

  • @microsoft/fabric-visuals — data visualization component built on those shared contracts
  • @microsoft/fabric-datagrid — grid/table component built on the same data and formatting model

Quick Reference

  • Package: @microsoft/fabric-visuals-core
  • Purpose: Shared types, data utilities, localization, format helpers, design tokens, and tooltips for the Fabric Apps visualization stack.
  • Use when: You need DataTable, ColumnDef, component localization, design tokens, a themed tooltip, data filtering/aggregation, or VBA format conversion. This is a required dependency for both @microsoft/fabric-visuals and @microsoft/fabric-datagrid.
  • Do NOT use when: You want to render charts (use @microsoft/fabric-visuals) or data grids (use @microsoft/fabric-datagrid) — those packages re-export what they need.
  • Key exports: DataTable, ColumnDef, DataCell, VisualTheme, VisualFramingProps, VisualContainerCapabilities, HeaderProps, loadStrings, getString, formatString, filterRows, aggregate, groupBy, convertVbaFormat, formatValue, tokens, spacing, injectDesignTokens, VISUALS_COMPONENT_LAYER, VISUALS_TOKENS_LAYER, createTooltip
  • Peer dependencies: None
  • Install: npm install @microsoft/fabric-visuals-core

Table of Contents

Installation

Install via npm:

npm install @microsoft/fabric-visuals-core

Data

To support the consistent sharing of dense, two-dimensional data to our components, we define a DataTable type that conveys this table of data, along with metadata corresponding to the columns of the associated data table. This metadata helps components render with the appropriate UX-facing display name, formats data values according to a format string, associates data with a semantic type, and sets a default aggregation for displaying totals.

export interface ColumnDef {
    readonly name: string;
    readonly displayName?: string;
    readonly format?: string;
    readonly semanticType?: SemanticType;
    readonly defaultAggregation?: AggregationFn;
    readonly disambiguateBy?: string;
}

export interface DataTable {
    readonly columns: ColumnDef[];
    readonly rows: unknown[][];
}

export type DataCell = DataTable['rows'][number][number];

The name is expected to be the referent for when components need to address a specific column. The data structure makes no guarantees that this name is unique among all columns, and callers should ensure that this name is unique to resist undefined behavior.

The displayName is expected to be used when displaying the name of the column, such as in axis titles or column headers.

The column's format is given in ECMA-376 format, a Microsoft documentation page is available. It is expected that wherever a data value is presented to a user that this format string is used to format the number (e.g., data label on a chart, cell value in a table).

semanticType explicitly inherits from Flint's semantic type system. It is expected that this semantic type is evaluated by an AI agent based on a sample of data and the column metadata; see Flint's authoring skill under the "Semantic types" heading an example. This property is only required when providing a Flint specification to the fabric-visuals data visualization component.

defaultAggregation sets the default aggregation when displaying a client-side-computed column total. This is used in the fabric-datagrid table component when showing a totals row.

disambiguateBy names another column that labels items sharing a value, for a column with group-on keys. For example, on a Name column grouped by EmployeeID, "Department" shows two employees named Sam Lee as "Sam Lee (Engineering)" and "Sam Lee (Sales)".

The data itself is explicitly untyped by unknown. It is up to the consuming component to derive appropriate semantics from the provided data and column metadata.

ISO storage dates

parseIsoCalendarDate validates a supported ISO date/date-time string and returns its written calendar day as YYYY-MM-DD, independently of display formatting and the user's timezone.

import { parseIsoCalendarDate } from '@microsoft/fabric-visuals-core';

parseIsoCalendarDate('2026-07-05'); // '2026-07-05'
parseIsoCalendarDate('2026-07-05T14:30:59.1234567+05:30'); // '2026-07-05'
parseIsoCalendarDate('2026-07-05T00:15:00+14:00'); // '2026-07-05', not the UTC day
parseIsoCalendarDate('2026-02-30'); // undefined

The supported subset is YYYY-MM-DD, optionally followed by THH:mm:ss, fractional-second digits, and Z or a signed HH:mm offset. Years are 0000 to 9999, and offsets allow hours 00-23 and minutes 00-59. The entire string, including any clock time and offset, is validated before extracting the day. Localized strings, surrounding whitespace, 24:00:00, leap seconds, and other ISO variants are unsupported. Parsing returns undefined for invalid or unsupported strings.

Time, fractional seconds, and timezone suffixes are intentionally discarded, without conversion to UTC or local time. This is a calendar-day parser, not a lossless timestamp parser. Its valid results can be compared directly as strings because fixed-width YYYY-MM-DD order matches calendar-day order. Do not apply that comparison to unvalidated inputs or use these day strings as exact instants; consumers are responsible for any backend-specific whole-day filtering.

Utilities, aggregation, filtering, and grouping

We provide some data utilities to do client-side operations on datasets stored in a DataTable format. If your data originates as Apache Arrow or other binary format, we recommend doing operations in that format instead (or pushing such data operations to the data provider backend), for performance reasons.

export function convertDataTableToRows(input: DataTable): Record<string, unknown>[]
export function isDataTable(input: unknown): input is DataTable

Filtering

export function selectColumns(table: DataTable, columnNames: readonly string[]): DataTable

Return a new table with only the named columns, in the requested order. Row order, cell values, and column metadata are preserved; the source table is not modified.

export function filterRows(
    table: DataTable,
    predicate: (row: unknown[], columns: readonly ColumnDef[]) => boolean,
): DataTable

Given a predicate, return a filtered DataTable containing rows for which the predicate evaluated to truthy.

export function getUniqueColumnValues(table: DataTable, columnName: string): unknown[]

Using JavaScript strict-equals semantics, return unique values for a specific column.

export function sliceRows(table: DataTable, start: number, end?: number): DataTable

Using the same semantics as Array.slice(), return a 0-indexed subset of the provided DataTable rows.

Aggregation / Group By

export type AggregationFn = 'sum' | 'min' | 'max' | 'average' | 'count' | 'distinctCount'
export interface AggregationSpec {
    readonly column?: string;
    readonly fn: AggregationFn;
    readonly as?: string;
}
export function aggregate(table: DataTable, spec: AggregationSpec): number | undefined

Given an aggregation specification, aggregate the specified column name by the targeted operation, returning a numerical aggregation. Numeric operations skip non-numeric values; an empty numeric set returns 0 for sum and undefined for min/max/average. Count returns the number of rows, ignoring the column. Distinct count uses JavaScript Set equality: null, undefined, and NaN each count as a distinct value, with repeated occurrences counted once. Empty input or missing schema columns return 0; absent cells in a declared column count as undefined. Object-keyed aggregation without a schema treats the requested key as present.

export function aggregateMany(
    table: DataTable,
    specs: readonly AggregationSpec[],
): Record<string, number | undefined>

export function aggregateByName(
    rows: readonly Record<string, unknown>[],
    spec: AggregationSpec,
): number | undefined

export function aggregateManyByName(
    rows: readonly Record<string, unknown>[],
    columns: readonly ColumnDef[],
    specs: readonly AggregationSpec[],
): Record<string, number | undefined>

The *ByName variants take object-keyed rows (Record<string, unknown>[]) instead of a DataTable. These functions are used by fabric-datagrid grand totals, whose rows are already keyed by column.

export function groupBy(
    table: DataTable,
    groupColumns: string[],
    aggregations: AggregationSpec[],
): DataTable

Given an aggregation specification, aggregate the specified column name by the targeted operation, removing the named column and replacing it with the AggregationSpec.as column name. If as is not specified, the template <fn>_<name> will be used for the new column. The generated column will inherit the other column metadata from the original column (displayName will match the generated name).

Columns not named by the aggregations are assumed to be the "group by" columns, so unique combinatorial sets of those columns will determine the aggregation scope.

Formatting data

To support components formatting data, we provide a convenience method based on the numfmt package. This method takes a given (numerical) value and formats it based on the given format string.

export function formatValue(
    value: unknown,
    vbaFormat: string | undefined,
    options?: { locale?: string, compact?: boolean },
): unknown

If the value is null or undefined, no formatting is attempted and the value is returned verbatim. Similarly, if no vbaFormat is provided, the value is returned verbatim.

With a date/time pattern, formatValue also formats the supported ISO storage date strings using the same temporal interpretation as charts.

locale affects the interpretation of number grouping and decimal punctuation. If not provided, try to recover the currently-set formatting locale via getFormattingLocale() (see below), or default to "en-US".

compact will attempt to use display units to generalize and shorten the number display. Under the hood, this uses the Intl.NumberFormat formatter, setting notation to 'compact', compactDisplay to 'short', and maximumFractionDigits to the max of the number of max fraction digits of the format string or 1, while also supplying the given locale as above. The compacted number is rehydrated with static textual elements from the format string.

For example, formatValue(100000, '$0.#', { compact: true }) will return "$100K".

isDateFormat(pattern) identifies date/time formats without mistaking quoted literal units for date tokens.

Localization

Centralizes localization functionality for use by child components. We (will) provide localization for all our components in all languages supported by Microsoft Fabric (see docs).

Built-in component strings are English (en-US) by default. Load another locale before rendering components to display translated labels and messages:

import {
    loadStrings,
    type AvailableLocale,
} from '@microsoft/fabric-visuals-core';

async function setLanguage(locale: AvailableLocale) {
    await loadStrings(locale);
    renderApplication();
}

Only the requested locale is loaded. Call loadStrings() again and re-render the application to switch languages. Missing translated values fall back to the default en-US strings.

For environments that cannot use dynamic imports, activate a statically imported locale:

import { setStrings } from '@microsoft/fabric-visuals-core';
import { strings } from '@microsoft/fabric-visuals-core/localization/locales/en';

setStrings('en', strings);

Use availableLocales to inspect the locales included in the installed package and getLoadedLocale() to read the active locale. getString() performs a type-safe lookup, while formatString() replaces positional ({0}) or named ({count}) placeholders.

Design Tokens and Theming

We define some static design tokens to standardize the design language around component formatting. This formatting includes spacing, typography, semantic colors, data colors, radii, and borders.

export const spacing: {
    readonly none: '0';
    readonly xxs: '2px';
    readonly xs: '4px';
    readonly sNudge: '6px';
    readonly s: '8px';
    readonly mNudge: '10px';
    readonly m: '12px';
    readonly l: '16px';
    readonly xl: '20px';
    readonly xxl: '24px';
    readonly xxxl: '32px';
}

export const fontSize: {
    readonly 100: '10px';
    readonly 200: '12px';
    readonly 300: '14px';
    readonly 400: '16px';
    readonly 500: '20px';
    readonly 600: '24px';
    readonly hero700: '28px';
    readonly hero800: '32px';
    readonly hero900: '40px';
    readonly hero1000: '68px';
}

export const lineHeight: {
    readonly 100: '14px';
    readonly 200: '16px';
    readonly 300: '20px';
    readonly 400: '22px';
    readonly 500: '28px';
    readonly 600: '32px';
    readonly hero700: '36px';
    readonly hero800: '40px';
    readonly hero900: '52px';
    readonly hero1000: '92px';
}

export const fontWeight: {
    readonly regular: 400;
    readonly medium: 500;
    readonly semibold: 600;
    readonly bold: 700;
}

export const fontFamily: {
    readonly heading: "'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif";
    readonly base: "'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif";
    readonly monospace: "Consolas, 'Courier New', Courier, monospace";
    readonly numeric: "Bahnschrift, 'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif";
}

export const iconSize: {
    readonly 100: '12px';
    readonly 200: '16px';
    readonly 300: '20px';
    readonly 400: '24px';
    readonly 500: '28px';
    readonly 600: '32px';
    readonly 700: '48px';
}

export const borderRadius: {
    readonly none: '0';
    readonly small: '2px';
    readonly medium: '4px';
    readonly large: '6px';
    readonly xLarge: '8px';
    readonly '2xl': '12px';
    readonly '3xl': '16px';
    readonly '4xl': '24px';
    readonly '5xl': '32px';
    readonly '6xl': '40px';
    readonly circular: '9999px';
}

export function injectDesignTokens(): boolean

Cascade layers

The visualization packages emit their CSS into two namespaced CSS @layers:

export const VISUALS_TOKENS_LAYER = 'fabric-visual-tokens'
export const VISUALS_COMPONENT_LAYER = 'fabric-visuals'

injectDesignTokens() places the default :root custom properties in fabric-visual-tokens. Griffel and static component rules from the visual, visual-container, and data-grid packages, and the tooltip stylesheet from createTooltip, use fabric-visuals. The tooltip's position is set on its element directly, so host rules can restyle it but not move it.

Because fabric-visual-tokens is declared before fabric-visuals, a host-specific layer-order declaration is not strictly needed when host overrides are unlayered. Normal unlayered author declarations targeting a visual or visual container naturally have higher priority than normal declarations in named layers (see MDN's Normal author declarations). Hosts whose overrides use named cascade layers must still declare where the Fabric layers belong before any of those layer names first appear.

export interface VisualTheme {
    foreground: string;
    foregroundSecondary: string;
    brandForeground: string;
    brandBackground: string;
    categoricalPalette?: readonly string[];
    background: string;
    backgroundSecondary: string;
    backgroundHover: string;
    stroke: string;
    scrollbarThumb?: string;
    typography?: {
        heading?: { family?: string; size?: number; weight?: number; style?: string };
        label?: { family?: string; size?: number; weight?: number; style?: string };
        dataLabel?: { family?: string; size?: number; weight?: number };
    };
    spacing?: {
        cellPadding?: string;
    };
    border?: {
        width?: number;
        radius?: string;
    };
}

export function readCssTheme(element?: Element): VisualTheme

We provide a default implementation of VisualTheme that roughly matches Power BI and FLuent 2 UI guidelines (see exported consts below). It is also possible to etch CSS variables into the document, then recall those settings into a VisualTheme object by using the function readCssTheme().

readCssTheme() builds categoricalPalette from a contiguous sequence of --color-data-1 through --color-data-10. If --color-data-1 is unset, the field remains undefined so chart packages can use their built-in palette. The values come from computed styles, so the same properties can be overridden inside the host's .dark rule to provide a dark-mode palette. CSS_CATEGORY_PALETTE_VARS exports the ordered custom-property names for tools that need to enumerate the supported slots.

export const CSS_VAR_BY_THEME_KEY: {
    readonly foreground: '--color-foreground';
    readonly background: '--color-card';
    readonly stroke: '--color-border';
    readonly foregroundSecondary: '--color-muted-foreground';
    readonly scrollbarThumb: '--color-scrollbar-thumb';
    readonly backgroundSecondary: '--color-muted';
    readonly backgroundHover: '--color-hover';
    readonly brandBackground: '--color-brand';
    readonly brandForeground: '--color-brand-foreground';
}

export const CSS_CATEGORY_PALETTE_VARS = [
    '--color-data-1',
    '--color-data-2',
    '--color-data-3',
    '--color-data-4',
    '--color-data-5',
    '--color-data-6',
    '--color-data-7',
    '--color-data-8',
    '--color-data-9',
    '--color-data-10',
]
export function cssThemeChanged(a: VisualTheme, b: VisualTheme): boolean
export const lightThemeColors: VisualTheme
export const darkThemeColors: VisualTheme

scrollbarThumb controls categorical scrollbar thumbs independently of text. Set --color-scrollbar-thumb when using readCssTheme(), including a .dark override for dark mode. The built-in light and dark defaults are #707070 and #999999. Custom VisualTheme objects can omit this field to keep using foregroundSecondary. High contrast always uses system colors instead.

Design Token Type Helpers

export type SpacingToken = keyof typeof spacing
export type FontSizeToken = keyof typeof fontSize
export type LineHeightToken = keyof typeof lineHeight
export type FontWeightToken = keyof typeof fontWeight
export type FontFamilyToken = keyof typeof fontFamily
export type IconSizeToken = keyof typeof iconSize
export type BorderRadiusToken = keyof typeof borderRadius
export type DesignToken = keyof typeof tokens

Visual framing contracts

VegaVisual and DataGrid share these renderer-facing framing props:

export interface VisualContainerCapabilities {
    /** Adds the built-in Copy Visual action. Defaults to true. */
    allowCopyVisual?: boolean;
}

export interface HeaderProps {
    /** Title displayed in the frame header. */
    title: string;
    /** Optional subtitle displayed below the title. */
    subtitle?: string;
}

export interface VisualFramingProps {
    /** Features enabled on the renderer-created frame. */
    visualContainerCapabilities?: VisualContainerCapabilities;
    /** Title and optional subtitle for the frame. */
    header?: HeaderProps;
    /** Removes the renderer-created frame. */
    chromeless?: boolean;
    /** CSS class for the frame's outer root: placement, margins and sizing. */
    containerRootClassName?: string;
    /** CSS class for the inner card surface: background, border, radius and padding. */
    containerClassName?: string;
}

For component behavior and direct usage, see the VisualContainer documentation.

Tooltips

createTooltip creates a tooltip that components can share, so tooltips look and behave the same across visuals. It fades in and out (0.3 seconds by default), takes its colors, typography, and border from a VisualTheme, and displays above all other content using the browser's Popover API. It ignores the pointer, so it never blocks the content underneath.

import { createTooltip } from '@microsoft/fabric-visuals-core';

const tooltip = createTooltip({ owner: chartElement });

chartElement.addEventListener('pointermove', (event) => {
    tooltip.show({
        content: {
            kind: 'entries',
            title: 'West',
            entries: [
                { key: 'Region', value: 'West' },
                { key: 'Sales', value: '$12,300' },
            ],
        },
        anchor: { kind: 'pointer', x: event.clientX, y: event.clientY },
        theme,
    });
});
chartElement.addEventListener('pointerleave', () => tooltip.hide());

// When the component unmounts:
tooltip.dispose();

Content can be:

  • { kind: 'entries', title?, image?, entries }: key/value rows. Keys line up at the left and values line up at the right in semibold. Values are shown as given, so format them first, for example with formatValue. Values wrap within 300px and show an ellipsis when truncated after five lines. An entry can have a swatch, a small symbol shown before its key, such as the legend symbol of the series the row describes:

    • color: the fill and outline color.
    • path: optional SVG path data for the shape, drawn in a box from -1 to 1. Defaults to a circle.
    • fillOpacity: optional opacity of the fill only, so the outline stays solid. Use 0 for an outline.
    • opacity: optional opacity of the whole swatch, for example to match a faded series.

    Swatches are vertically centered beside their key text, including multiline keys. They are decorative and hidden from screen readers, so the key must still name the series. When forced colors are active, they're drawn in the system text color.

    Set emphasized: true on the row the user is pointing at, such as the hovered series in a list of series. The row gets a subtle background in the theme's backgroundHover color (the --color-hover design token), drawn behind the row so the tooltip doesn't change size as emphasis moves. When forced colors are active, the row uses the system selection colors (Highlight and HighlightText). Emphasis is visual only, so don't rely on it to convey information.

  • { kind: 'text', text }: plain text. Line breaks are preserved.

  • { kind: 'custom' }: shows tooltip.contentElement, which you render into yourself, for example through a React portal. The element stays the same for the tooltip's lifetime, so you can update its content in place, and the tooltip repositions when the content changes size.

To show several parts together, pass a list. The parts are shown top to bottom, and custom content can appear only once:

tooltip.show({
    content: [
        { kind: 'entries', entries: [{ key: 'Sales', value: '$12,300' }] },
        { kind: 'custom' }, // for example, a sparkline rendered into tooltip.contentElement
    ],
    anchor: { kind: 'pointer', x: event.clientX, y: event.clientY },
    theme,
});

The tooltip is placed below and to the right of the anchor, flipping to stay inside the viewport. With a pointer anchor, it keeps following the pointer while it fades out. Use a point anchor for a fixed position, such as the center of a mark focused with the keyboard. Showing one tooltip fades out any other. Set offsetX and offsetY on createTooltip to change the gap from the anchor (10px by default). To describe an element with the tooltip for screen readers, add tooltip.id to its aria-describedby.

Hosts can override the value width with --fabric-tooltip-value-max-width (300px by default) and the fade duration with --fabric-tooltip-fade-duration on :root. Setting these properties on an element around the visual has no effect, because the tooltip is added to <body>, not inside the visual. Users who prefer reduced motion see no fade.

Screen reader announcements

getScreenReaderAnnouncer() returns the app-wide, framework-independent singleton. The first call creates polite and assertive live regions in document.body; subsequent callers reuse them without supplying a document or attachment element. The regions remain for the app's lifetime, even when individual components unmount.

import { getScreenReaderAnnouncer, getString } from '@microsoft/fabric-visuals-core';
import type { ScreenReaderAnnouncer } from '@microsoft/fabric-visuals-core';

const announcements: ScreenReaderAnnouncer = getScreenReaderAnnouncer();
const channel: symbol = Symbol('row selection');
announcements.announce(getString('DataGrid_RowSelected'), { channel });
announcements.announce(getString('DataGrid_SelectionCleared'), { channel });
announcements.announce(getString('DataGrid_NoSelectableIdentityColumns'), { channel, politeness: 'assertive' });
announcements.cancel(channel); // Cancel stale feedback, e.g. when this component unmounts.

Messages are already-localized plain text, never HTML. Polite announcements use an 800 ms trailing debounce; assertive announcements request interruption and default to no debounce. Both include an additional 100 ms empty-region delay so identical messages can be announced again (900 ms total by default for polite, 100 ms for assertive). These delays are fixed. Actual speech timing is controlled by the screen reader.

Use a stable string or symbol channel to isolate each caller's debouncing and cancellation. Omit it for the shared default channel. A new message replaces only the same channel's previous message, even across priorities. Messages occupy separate atomic children of the shared regions so updating one does not repeat other channels' text. cancel(channel) removes that channel's pending work and message; cancel() targets only the default channel. Blank messages cancel their channel as well. Cancellation does not remove the shared regions.

Call dispose() only for app-level teardown (or test isolation). It cancels all channels and removes the regions; the next getScreenReaderAnnouncer() creates a fresh singleton. Disposal is idempotent, and announcing on a disposed instance throws. The service never moves focus or creates a visible notification. Importing is safe without a DOM; requesting the singleton requires a browser document with a body.

Modal accessibility limitation: Some dialog libraries mark content outside the active dialog as aria-hidden or inert. This can hide the body-level live regions from assistive technology, so announcements may not be heard while such a modal is open. The singleton does not relocate its regions or override those attributes. Apps that require announcements inside these dialogs must use the dialog's own accessible feedback mechanism or explicitly accommodate the regions in their modal infrastructure.

Copy to Clipboard

VegaVisual and DataGrid share copy to clipboard functionality. Components own their localized feedback, while image capture and clipboard writes remain with their callers. This package contains the shared clipboard error classificaiton.

Examples

import { aggregate, convertDataTableToRows, filterRows, formatValue, injectDesignTokens, type DataTable } from '@microsoft/fabric-visuals-core';

const table: DataTable = {
    columns: [
        { name: 'region', displayName: 'Region' },
        { name: 'city', displayName: 'City' },
        { name: 'sales', displayName: 'Sales', format: '$#,##0.00', },
        { name: 'year', displayName: 'Year' },
    ],
    rows: [
        ['West', 'Seattle', 1200, 2024],
        ['East', 'New York', 900, 2024],
    ],
};
const rows = convertDataTableToRows(table);
const westOnly = filterRows(table, (row) => row[0] === 'West');
const total = aggregate(table, { column: 'sales', fn: 'sum' });
const label = formatValue(1200, '$#,##0.00');
injectDesignTokens();
import { spacing, tokens, lightThemeColors, readCssTheme } from '@microsoft/fabric-visuals-core';

spacing.s;                // '8px'
tokens.spacingS;          // 'var(--spacing-s)'
lightThemeColors.stroke;  // '#e0e0e0'
const theme = readCssTheme(); // `VisualTheme` from document-set CSS variables

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.

Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories in our GitHub organizations.

Please do not report security vulnerabilities through public GitHub issues.

For security reporting information, locations, contact information, and policies, please review the latest guidance for Microsoft repositories at https://aka.ms/SECURITY.md.

Code of conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

See full Microsoft Open Source Code of Conduct