Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

powerbi-client-react

> 编程语言
Open source

Power BI for React which provides components and services to enabling developers to easily embed Power BI reports into their applications.

364 stars0 likes1 views
WebsiteGitHub

About

Power BI for React which provides components and services to enabling developers to easily embed Power BI reports into their applications.

powerbi-client-react

Power BI React component. This library enables you to embed Power BI reports, dashboards, dashboard tiles, report visuals, Q&A or paginated reports in your React application, and to create new Power BI reports directly in your application.

Quick Start

Import

javascript
import { PowerBIEmbed } from 'powerbi-client-react';

Embed a Power BI report

…

How to bootstrap a PowerBI report:

javascript

Note: To embed the report after bootstrap, update the props (with at least accessToken).

Demo

This demo includes a React application that demonstrates the complete flow of embedding a sample report using the PowerBIEmbed component.

The demo shows how to bootstrap the report, embed it, and update it. Additionally, the demo showcases the usage of the powerbi report authoring library by enabling the user to change the type of visual from a report using the "Change visual type" button.

The demo also sets a "DataSelected" event, which allows the user to interact with the embedded report and retrieve information about the selected data.

To run the demo on localhost, run the following commands:

bash
npm run demo

Redirect to http://localhost:8080/ to view in the browser.

Usage

Use case Details
Embed Power BI To embed your powerbi artifact, pass the component with atleast type, embedUrl and accessToken in embedConfig prop.
Get reference to the embedded object Pass a callback method which accepts the embedded object as parameter to the getEmbeddedComponent of props.
Refer to the getEmbeddedComponent prop in Quick Start.
Apply style class Pass the name(s) of style classes to be added to the embed container div to the cssClassName props.
Set event handlers Pass a map object of event name (string) and event handler (function) to the eventHandlers prop.
Key: Event name
Value: Event handler method to be triggered
Event handler method takes 2 optional params:
First parameter: Event
Second parameter: Reference to the embedded entity
Reset event handlers To reset event handler for an event, set the event handler's value as null in the eventHandlers map of props.
Update settings (Report type only) To update the report settings, update the embedConfig.settings property of props.
Refer to the embedConfig.settings prop in Quick Start.
Note: Update the settings only by updating embedConfig prop
Bootstrap Power BI To bootstrap your powerbi entity, pass the props to the component without accessToken in embedConfig.
Note: embedConfig of props should at least contain type of the powerbi entity being embedded.
Available types: "report", "dashboard", "tile", "visual", "qna" and "paginated report".
Refer to How to bootstrap a report section in Quick Start.
Using with PowerBI Report Authoring 1. Install powerbi-report-authoring as npm dependency.
2. Use the report authoring APIs using the embedded report's instance
Phased embedding (Report type only) Set phasedEmbedding prop's value as true
Refer to Phased embedding docs.
Apply Filters (Report type only) 1. To apply updated filters, update filters in embedConfig props.
2. To remove the applied filters, update the embedConfig prop with the filters removed or set as undefined/null.
Set Page (Report type only) To set a page when embedding a report or on an embedded report, provide pageName field in the embedConfig.
Create report To create a new report, pass the component with at least type, embedUrl and datasetId in embedConfig prop.

Note: To use this library in IE browser, use react-app-polyfill to add support for the incompatible features. Refer to the imports of demo/index.tsx.

Props interface

…

Supported Events

Events supported by various Power BI entities:

Entity Event
Report "buttonClicked", "commandTriggered", "dataHyperlinkClicked", "dataSelected", "loaded", "pageChanged", "rendered", "saveAsTriggered", "saved", "selectionChanged", "visualClicked", "visualRendered"
Dashboard "loaded", "tileClicked"
Tile "tileLoaded", "tileClicked"
QnA "visualRendered"

Event Handler to be used with Map

typescript
type EventHandler = (event?: service.ICustomEvent, embeddedEntity?: Embed) => void | null;

Using supported SDK methods for Power BI artifacts

Import

Import the 'PowerBIEmbed' inside your targeted component file:

typescript
import { PowerBIEmbed } from 'powerbi-client-react';

Use

You can use report state to call supported SDK APIs.

Steps:

  1. Create one state for storing the report object, for example, const [report, setReport] = useState();.

  2. Use the setReport method inside the component to set the report object.

typescript
 {
		setReport(embedObject as Report);
	} }
/>
  1. Once the report object is set, it can be used to call SDK methods such as getVisuals, getBookmarks, etc.
typescript
async getReportPages(): Page[] {
	// this.report is a class variable, initialized in step 3
	const activePage: Page | undefined = await report.getActivePage();
	console.log(pages);
}

Note

The library supports React applications having version >= 18.

Dependencies

powerbi-client

Peer dependencies

react

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.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments

Data Collection.

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications.

If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at Microsoft Privacy Statement. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Support

  • Feature Requests: Submit your ideas and suggestions to the Fabric Ideas Portal, where you can also vote on ideas from other developers.
  • Bug Reports and Technical Assistance: Visit the Fabric Developer Community Forum. Our team and community experts are ready to assist you.
  • Additional Support: Contact your account manager or reach out to the Fabric Support Team.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言