
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
msteams-react-base-component
Advanced tools
React helper components for Microsoft 365 Teams, Office and Outlook apps
This is a set of React hooks and providers based on the Microsoft Teams JavaScript SDK, the Fluent UI components and Microsoft Graph Toolkit, which is used when generating Microsoft Teams Apps using the Microsoft Teams Yeoman Generator.
| @master | @preview |
|---|---|
useTeams hookTo use this package in a Teams tab or extension import the useTeams Hook and then call it inside a functional component.
const [{inTeams}] = useTeams();
The useTeams hook will return a tuple of where an object of properties are in the first field and an object of methods in the second.
NOTE: using the hook will automatically initialize the Microsoft Teams JS SDK is available.
The useTeams hook can take an optional object argument:
| Argument | Description |
|---|---|
initialTheme?: string | Manually set the initial theme (default, dark or contrast) |
setThemeHandler?: (theme?: string) => void | Custom handler for themes |
| Property name | Type | Description |
|---|---|---|
inTeams | boolean? | true if hosted in Teams and false for outside of Microsoft Teams |
fullScreen | boolean? | true if the Tab is in full-screen, otherwise false |
themeString | string | The value of default, dark or contrast |
theme | ThemePrepared | The Fluent UI Theme object for the current theme |
context | Context? | undefined while the Tab is loading or if not hosted in Teams, set to a value once the Tab is initialized and context available |
| Method name | Description |
|---|---|
setTheme(theme?: string) | Method for manually setting the theme |
Example of usage:
import * as React from "react";
import { Provider, Flex, Header } from "@fluentui/react-northstar";
import { useState, useEffect } from "react";
import { useTeams } from "msteams-react-base-component";
/**
* Implementation of the hooks Tab content page
*/
export const HooksTab = () => {
const [{ inTeams, theme }] = useTeams({});
const [message, setMessage] = useState("Loading...");
useEffect(() => {
if (inTeams === true) {
setMessage("In Microsoft Teams!");
} else {
if (inTeams !== undefined) {
setMessage("Not in Microsoft Teams");
}
}
}, [inTeams]);
return (
<Provider theme={theme}>
<Flex fill={true}>
<Flex.Item>
<Header content={message} />
</Flex.Item>
</Flex>
</Provider>
);
};
Copyright (c) Wictor Wilén. All rights reserved.
Licensed under the MIT license.
FAQs
React helper components for Microsoft 365 Teams, Office and Outlook apps
The npm package msteams-react-base-component receives a total of 848 weekly downloads. As such, msteams-react-base-component popularity was classified as not popular.
We found that msteams-react-base-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.