9.1.0 • Published 4 months ago

@fluentui/react-jsx-runtime v9.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@fluentui/react-jsx-runtime

React JSX runtime for Fluent UI React

Fluent UI React requires the usage of a custom JSX runtime to support the slots API

Usage

!NOTE This custom JSX pragma should only be used in cases where you are trying to use the internal Fluent UI React slot API in conjunction with assertSlots().

If you are not using the internal slot API, don't use it.

In case you want to re-compose a component and redeclare its render method then this API will be necessary, learn more on Rendering a component with slots

To properly render a component with slots, our custom createElement method needs to be used instead of default React.createElement:

NOTE: It works with both automatic or classic jsxRuntime configuration.

React 17+

infers @jsxRuntime automatic

/** @jsxImportSource @fluentui/react-jsx-runtime */

import { assertSlots } from '@fluentui/react-utilities';

const renderButton_unstable = (state: ButtonState) => {
  const { iconOnly, iconPosition } = state;

  assertSlots<ButtonSlots>(state);

  return (
    <state.root>
      {iconPosition !== 'after' && state.icon && <state.icon />}
      {!iconOnly && state.root.children}
      {iconPosition === 'after' && state.icon && <state.icon />}
    </state.root>
  );
};

React 16

infers @jsxRuntime classic

/** @jsx createElement */

// in order to apply our custom `createElement` factory to jsx transforms, to support slot creation, we need to import it physically
import { createElement } from '@fluentui/react-jsx-runtime';

import { assertSlots } from '@fluentui/react-utilities';

const renderButton_unstable = (state: ButtonState) => {
  const { iconOnly, iconPosition } = state;

  assertSlots<ButtonSlots>(state);

  return (
    <state.root>
      {iconPosition !== 'after' && state.icon && <state.icon />}
      {!iconOnly && state.root.children}
      {iconPosition === 'after' && state.icon && <state.icon />}
    </state.root>
  );
};
@everything-registry/sub-chunk-330copilot-panel@fluentui/react-persona@fluentui/react-aria@fluentui/react-avatar@fluentui/react-badge@fluentui/react-breadcrumb@fluentui/react-carousel@fluentui/react-carousel-preview@fluentui/react-charts@fluentui/react-charts-preview@fluentui/react-checkbox@fluentui/react-color-picker@fluentui/react-accordion@fluentui/react-alert@fluentui/react-breadcrumb-preview@fluentui/react-button@fluentui/react-calendar-compat@fluentui/react-card@fluentui/react-color-picker-preview@fluentui/react-combobox@fluentui/react-popover@fluentui/react-rating@fluentui/react-rating-preview@fluentui/react-search@fluentui/react-search-preview@fluentui/react-select@fluentui/react-progress@fluentui/react-provider@fluentui/react-radio@fluentui/react-teaching-popover-preview@fluentui/react-text@fluentui/react-textarea@fluentui/react-tooltip@fluentui/react-tree@fluentui/react-virtualizer@fluentui/react-tabs@fluentui/react-tag-picker@fluentui/react-tag-picker-preview@fluentui/react-tags@fluentui/react-tags-preview@fluentui/react-teaching-popover@fluentui/react-spinner@fluentui/react-swatch-picker@fluentui/react-swatch-picker-preview@fluentui/react-switch@fluentui/react-table@fluentui/react-timepicker-compat@fluentui/react-timepicker-compat-preview@fluentui/react-toast@fluentui/react-toolbar@fluentui/react-skeleton@fluentui/react-slider@fluentui/react-spinbutton@fluentui/react-datepicker-compat@fluentui/react-dialog@fluentui/react-divider@fluentui/react-menu@fluentui/react-message-bar@fluentui/react-message-bar-preview@fluentui/react-migration-v0-v9@fluentui/react-drawer@fluentui/react-field@fluentui/react-data-grid-react-window@fluentui/react-icons-compat@fluentui/react-image@fluentui/react-label@fluentui/react-link@fluentui/react-list@fluentui/react-list-preview@fluentui/react-infobutton@fluentui/react-infolabel@fluentui/react-infolabel-preview@fluentui/react-input@fluentui/react-motion-preview@fluentui/react-nav@fluentui/react-nav-preview@fluentui-contrib/react-chat@fluentui-contrib/react-interactive-tab@fluentui-contrib/react-keytips@fluentui-contrib/react-themeless-provider@fluentui-contrib/react-tree-grid
9.0.49

9 months ago

9.0.46

11 months ago

9.0.48

10 months ago

9.0.47

11 months ago

9.0.53

7 months ago

9.0.52

7 months ago

9.0.55

4 months ago

9.0.54

6 months ago

9.0.51

7 months ago

9.0.50

9 months ago

9.1.0

4 months ago

9.0.45

1 year ago

9.0.44

1 year ago

9.0.43

1 year ago

9.0.39

1 year ago

9.0.42

1 year ago

9.0.41

1 year ago

9.0.40

1 year ago

9.0.38

1 year ago

9.0.37

1 year ago

9.0.36

1 year ago

9.0.35

2 years ago

9.0.34

2 years ago

9.0.33

2 years ago

9.0.32

2 years ago

9.0.31

2 years ago

9.0.30

2 years ago

9.0.29

2 years ago

9.0.28

2 years ago

9.0.27

2 years ago

9.0.26

2 years ago

9.0.25

2 years ago

9.0.24

2 years ago

9.0.23

2 years ago

9.0.22

2 years ago

9.0.21

2 years ago

9.0.9

2 years ago

9.0.8

2 years ago

9.0.7

2 years ago

9.0.6

2 years ago

9.0.5

2 years ago

9.0.4

2 years ago

9.0.3

2 years ago

9.0.2

2 years ago

9.0.1

2 years ago

9.0.0

2 years ago

9.0.0-alpha.15

2 years ago

9.0.0-alpha.16

2 years ago

9.0.0-alpha.13

2 years ago

9.0.0-alpha.14

2 years ago

9.0.0-alpha.11

2 years ago

9.0.0-alpha.12

2 years ago

9.0.0-alpha.10

2 years ago

9.0.17

2 years ago

9.0.16

2 years ago

9.0.19

2 years ago

9.0.18

2 years ago

9.0.13

2 years ago

9.0.12

2 years ago

9.0.15

2 years ago

9.0.14

2 years ago

9.0.11

2 years ago

9.0.10

2 years ago

9.0.20

2 years ago

9.0.0-alpha.9

2 years ago

9.0.0-alpha.7

2 years ago

9.0.0-alpha.8

2 years ago

9.0.0-alpha.6

2 years ago

9.0.0-alpha.5

2 years ago

9.0.0-alpha.4

2 years ago

9.0.0-alpha.3

2 years ago

9.0.0-alpha.2

2 years ago

9.0.0-alpha.1

3 years ago