Fluentui: use modularized fluent

Created on 5 Mar 2020  ·  6Comments  ·  Source: microsoft/fluentui

Environment Information

  • Package version(s): Library: Fluent-ui-react
  • Browser and OS versions: latest

Please provide a reproduction of the bug in a codepen:

I want to use modularized fluent-ui

import { Box, Provider, themes } from '@fluentui/react'

I only need Box Component, but there are many other components In theme Object
like AvatarStyles、DialogStyles tec

Actual behavior:

in fluent-ui source code

export const themes = { fontAwesome, teams, teamsDark, teamsHighContrast };

Expected behavior:

what can I do if I only need teams themes?
what can I do if I only need some Components?

Priorities and help requested:

Are you willing to submit a PR to fix? (Yes, No)

Requested priority: High

Products/sites affected: Consumers should not be penalized for code they don't use (through bundle size, perf, etc).

Fluent UI react-northstar Question ❔

Most helpful comment

@zerofront I opened #12224 to fix broken exports.

Future items:

All 6 comments

Hi @zerofront, there's documentation & example code on the Fluent site about the case when you want to import just a few components & use the teams theme - is this what you're looking for? https://fluentsite.z22.web.core.windows.net/theming-examples

Hi @aneeshack4 , Thank you for your prompt reply

import React from 'react'
import { Button, Icon, Label, Provider, themes } from '@fluentui/react'

export default () => (
  <Provider theme={themes.teams}>
    <Button content="Button" />
    <Button icon="add" iconOnly primary />
    <Button icon="email" content="Send email" secondary />
    <Icon name="emoji" size="larger" />
    <Label content="Label with icon" icon="close" />
  </Provider>
)

For this example, I just want to import Button、icon、Label Component,but in theme object, therer are many style of other component which is unnecessary。

@zerofront I opened #12224 to fix broken exports.

Future items:

@layershifter - doing some housekeep here. do you think we need to leave this issue open or can be closed?

@xugao I think that we can close this as a duplicate and keep #12953.

Duplicate of #12953

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rickyp-ms picture rickyp-ms  ·  3Comments

prashkan picture prashkan  ·  3Comments

VincentBailly picture VincentBailly  ·  3Comments

carruthe picture carruthe  ·  3Comments

carruthe picture carruthe  ·  3Comments