GithubHelp home page GithubHelp logo

classicvalues / microsoft-teams-ui-component-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from officedev/microsoft-teams-ui-component-library

1.0 1.0 0.0 2.6 MB

Component library enhanced experiences styled for use in Microsoft Teams custom applications.

License: MIT License

JavaScript 0.76% PowerShell 1.93% TypeScript 97.31%

microsoft-teams-ui-component-library's Introduction

@fluentui/react-teams

npm version

API Documentation

This library of React components implements many of the designs released in the Microsoft Teams UI Kit. With these components, your Teams app can offer accessible, high-quality experiences that align with Microsoft Teams.

Installation

This library expects a few peer dependencies; if your project doesn’t have them at these versions, you’ll need to add or upgrade them:

  • react@^16.8.0
  • react-dom@^16.8.0
  • @fluentui/react-northstar@^0.54.0

Next, simply add as a dependency to your project:

yarn add @fluentui/react-teams

or

npm i --save @fluentui/react-teams

Use TypeScript without any for these components’ props

Since the components require fairly specific, structured props, development is far easier in projects that use TypeScript. Avoid typing props passed to these components as any in order to ensure your content’s types are checked.

The API’s promises are communicated in the docs, which are derived directly from the type declarations. This library uses semver to indicate breaking changes in the API, so props that pass a type check will still work for all releases of this library with the same major version.

Getting started

Always use the provider

For these components to work properly, they need their provider.

import {Provider as RTProvider, Board } from "@fluentui/react-teams";

export default (props) => {
  
  const boardProps = getBoardProps(props)
  
  return <RTProvider themeName="teamsTheme" lang="en-US">
    <Board {...boardProps} />
  </RTProvider>
  
}

The provider accepts a themeName, which can be teamsTheme for the default (light) Teams theme, teamsDarkTheme, or teamsHighContrastTheme.

Content

Each component’s content props accept data that can be serialized to JSON. This means that instead of nesting components with fairly atomic props, components in this library don’t accept children and take props with fairly specific structures.

Consider modeling your use case after examples provided in this library’s Storybook or by examining the componnt’s TypeScript types.

Interactions

Components with interactivity accept an onInteraction handler, which calls your function any time a user triggers an event you can respond to. The handler is called with a payload (also designed to be serialized to JSON) like this:

{
  "event": "click",
  "target": "toolbar",
  "subject": ["item1", "item2"],
  "action": "delete"
}

This payload differs depending on the component and the kinds of interactions it supports; consider checking the type of onInteraction on the component you want to use in the API docs.

Localization

Developers can override all text with their own wording by providing a TTranslations object to the translations prop on the HVCThemeProvider component. US English is already built-in.

Any component props which become rendered text in the UI are defined as a TTextObject, which lets you configure what to display in supported locales.

API Docs

You can read more about each component’s specific props and their types in the API docs in the docs folder. The index for the entire project is docs/react-teams.md.

The best place to start for each component is its I{Component}Props, where Component is the component name, e.g. the main API docs for Board is IBoardProps.

Improving this library

First, clone this repository. Then install dependencies with yarn:

yarn

To start Storybook, run the start script:

yarn start

…then point your browser to:

http://localhost:3000

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.

microsoft-teams-ui-component-library's People

Contributors

akatrukhin avatar thure avatar asnow003 avatar microsoftopensource avatar heath-hamilton avatar automation avatar ronwang01 avatar microsoft-github-operations[bot] avatar

Stargazers

Classic Values avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.