4.2.1 • Published 1 month ago

@microsoft/mgt v4.2.1

Weekly downloads
3,868
License
MIT
Repository
github
Last release
1 month ago

Microsoft Graph Toolkit

NPM code style: prettier stackoverflow Build Status Published on webcomponents.org Storybook

The Microsoft Graph Toolkit is a collection of web components powered by the Microsoft Graph.

Components are functional and work automatically with the Microsoft Graph

Components work with any web framework and on all modern browsers. IE 11 is also supported

Here is a quick jsfiddle

Components & Documentation

The toolkit currently includes the following components:

And the following providers:

View the full documentation

You can now explore components and samples with the playground powered by storybook.

Getting Started

Watch the Getting Started Video

You can use the components by referencing the loader directly (via unpkg), or installing the npm package

Use via mgt-loader:

<script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js"></script>

You can then start using the components in your html page. Here is a full working example with the Msal provider:

<script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js"></script>
<mgt-msal-provider client-id="[CLIENT-ID]"></mgt-msal-provider>
<mgt-login></mgt-login>

<!-- <script>
    // alternatively, you can set the provider in code and provide more options
    mgt.Providers.globalProvider = new mgt.MsalProvider({clientId: '[CLIENT-ID]'});
</script> -->

NOTE: MSAL requires the page to be hosted in a web server for the authentication redirects. If you are just getting started and want to play around, the quickest way is to use something like live server in vscode.

Use via NPM:

The benefits of using MGT through NPM is that you have full control of the bundling process and you can bundle only the code you need for your site. First, add the npm package:

npm install @microsoft/mgt

Now you can reference all components at the page you are using:

<script src="node_modules/@microsoft/mgt/dist/es6/components.js"></script>

Or, just reference the component you need and avoid loading everything else:

<script src="node_modules/@microsoft/mgt/dist/es6/components/mgt-login/mgt-login.js"></script>

Similarly, to add a provider, you can add it as a component:

<script src="node_modules/@microsoft/mgt/dist/es6/components/providers/mgt-msal-provider.js"></script>

<mgt-msal-provider client-id="[CLIENT-ID]"></mgt-msal-provider>

or, add it in your code:

<script type="module">
  import { Providers, MsalProvider } from '@microsoft/mgt';

  Providers.globalProvider = new MsalProvider({ clientId: '[CLIENT-ID]' });
</script>

Providers

The components work best when used with a provider. The provider exposes authentication and Microsoft Graph apis used by the components to call into the Microsoft Graph.

The toolkit contains providers for MSAL, SharePoint, and Teams. You can also create your own providers by extending the IProvider abstract class.

Contribute

We enthusiastically welcome contributions and feedback. Please read the contributing guide before you begin.

Feedback and Requests

For general questions and support, please use Stack Overflow where questions should be tagged with microsoft-graph-toolkit

Please use GitHub Issues for bug reports and feature requests. We highly recommend you browse existing issues before opening new issues.

License

All files in this GitHub repository are subject to the MIT license. This project also references fonts and icons from a CDN, which are subject to a separate asset license.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

4.2.1

1 month ago

4.1.0

2 months ago

4.0.1

3 months ago

4.0.0

3 months ago

3.1.3

7 months ago

3.1.2

8 months ago

3.1.1

9 months ago

3.1.0

9 months ago

3.0.1

10 months ago

2.11.2

10 months ago

3.0.0

10 months ago

2.11.0

11 months ago

2.11.1

11 months ago

3.0.0-preview.2

12 months ago

2.10.1

1 year ago

3.0.0-rc.2

11 months ago

3.0.0-rc.1

11 months ago

3.0.0-rc.3

11 months ago

3.0.0-preview.1

1 year ago

2.10.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.8.0

1 year ago

2.9.0

1 year ago

2.7.0

2 years ago

2.7.1

2 years ago

2.6.2

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.4.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-rc.1

3 years ago

2.0.0-preview.9

3 years ago

2.0.0-preview.8

3 years ago

2.0.0-preview.6

3 years ago

1.3.6

3 years ago

2.0.0-preview.4

3 years ago

2.0.0-preview.3

4 years ago

1.3.5

4 years ago

2.0.0-preview.1

4 years ago

1.4.0-preview.1

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.3.0-preview.3

4 years ago

1.3.0-preview.2

4 years ago

1.3.0-preview.1

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.0-preview.2

4 years ago

1.1.0-preview.1

5 years ago

1.0.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.1.0-preview.8

5 years ago

0.1.0-preview.7

5 years ago

0.1.0-preview.6

5 years ago

0.1.0-preview.5

5 years ago

0.1.0-preview.4

5 years ago

0.1.0-preview.3

5 years ago

0.1.0-preview.2

5 years ago