@fluentui/react-button 9.0.0-alpha.10 → 9.0.0-alpha.100
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +2418 -1
- package/CHANGELOG.md +920 -2
- package/README.md +19 -108
- package/dist/demo/index.html +71 -0
- package/dist/demo/react-dom.development.js +21413 -0
- package/dist/demo/react.development.js +3155 -0
- package/dist/react-button.d.ts +204 -82
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.d.ts +1 -0
- package/lib/CompoundButton.js +2 -0
- package/lib/CompoundButton.js.map +1 -0
- package/lib/MenuButton.d.ts +1 -0
- package/lib/MenuButton.js +2 -0
- package/lib/MenuButton.js.map +1 -0
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/ToggleButton.d.ts +1 -0
- package/lib/ToggleButton.js +2 -0
- package/lib/ToggleButton.js.map +1 -0
- package/lib/common/isConformant.d.ts +4 -2
- package/lib/common/isConformant.js +9 -6
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Button/Button.d.ts +4 -11
- package/lib/components/Button/Button.js +7 -16
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.d.ts +57 -60
- package/lib/components/Button/Button.types.js +1 -0
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.d.ts +1 -2
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.d.ts +2 -2
- package/lib/components/Button/renderButton.js +9 -8
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +5 -7
- package/lib/components/Button/useButton.js +49 -23
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.d.ts +10 -4
- package/lib/components/Button/useButtonStyles.js +350 -378
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib/components/CompoundButton/CompoundButton.js +15 -0
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib/components/CompoundButton/CompoundButton.types.js +2 -0
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib/components/CompoundButton/index.d.ts +5 -0
- package/lib/components/CompoundButton/index.js +6 -0
- package/lib/components/CompoundButton/index.js.map +1 -0
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib/components/CompoundButton/renderCompoundButton.js +17 -0
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib/components/CompoundButton/useCompoundButton.js +29 -0
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +164 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib/components/MenuButton/MenuButton.js +15 -0
- package/lib/components/MenuButton/MenuButton.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib/components/MenuButton/MenuButton.types.js +2 -0
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib/components/MenuButton/index.d.ts +5 -0
- package/lib/components/MenuButton/index.js +6 -0
- package/lib/components/MenuButton/index.js.map +1 -0
- package/lib/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib/components/MenuButton/renderMenuButton.js +17 -0
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib/components/MenuButton/useMenuButton.js +32 -0
- package/lib/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js +34 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +16 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +15 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib/components/SplitButton/useSplitButton.js +73 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +77 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib/components/ToggleButton/ToggleButton.js +15 -0
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib/components/ToggleButton/ToggleButton.types.js +2 -0
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib/components/ToggleButton/index.d.ts +5 -0
- package/lib/components/ToggleButton/index.js +6 -0
- package/lib/components/ToggleButton/index.js.map +1 -0
- package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib/components/ToggleButton/renderToggleButton.js +2 -0
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib/components/ToggleButton/useToggleButton.js +50 -0
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js +190 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Button.js +7 -2
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.d.ts +1 -0
- package/lib-commonjs/CompoundButton.js +10 -0
- package/lib-commonjs/CompoundButton.js.map +1 -0
- package/lib-commonjs/MenuButton.d.ts +1 -0
- package/lib-commonjs/MenuButton.js +10 -0
- package/lib-commonjs/MenuButton.js.map +1 -0
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/ToggleButton.d.ts +1 -0
- package/lib-commonjs/ToggleButton.js +10 -0
- package/lib-commonjs/ToggleButton.js.map +1 -0
- package/lib-commonjs/common/isConformant.d.ts +4 -2
- package/lib-commonjs/common/isConformant.js +19 -8
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Button/Button.d.ts +4 -11
- package/lib-commonjs/components/Button/Button.js +20 -20
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.d.ts +57 -60
- package/lib-commonjs/components/Button/Button.types.js +4 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.d.ts +1 -2
- package/lib-commonjs/components/Button/index.js +21 -5
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.d.ts +2 -2
- package/lib-commonjs/components/Button/renderButton.js +24 -13
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +5 -7
- package/lib-commonjs/components/Button/useButton.js +59 -24
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +10 -4
- package/lib-commonjs/components/Button/useButtonStyles.js +360 -379
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +26 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/index.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/index.js +26 -0
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +29 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +41 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +175 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js +26 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib-commonjs/components/MenuButton/index.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/index.js +26 -0
- package/lib-commonjs/components/MenuButton/index.js.map +1 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +29 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js +46 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +44 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +86 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +88 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +26 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/index.d.ts +5 -0
- package/lib-commonjs/components/ToggleButton/index.js +26 -0
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +16 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +63 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +200 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -0
- package/lib-commonjs/index.js +15 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +21 -14
- package/config/api-extractor.json +0 -3
- package/config/pre-copy.json +0 -9
- package/config/tests.js +0 -6
- package/etc/react-button.api.md +0 -104
- package/just.config.ts +0 -3
- package/lib/components/Button/useButtonState.d.ts +0 -6
- package/lib/components/Button/useButtonState.js +0 -45
- package/lib/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/Button.d.ts +0 -1
- package/lib-amd/Button.js +0 -6
- package/lib-amd/Button.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Button/Button.d.ts +0 -13
- package/lib-amd/components/Button/Button.js +0 -24
- package/lib-amd/components/Button/Button.js.map +0 -1
- package/lib-amd/components/Button/Button.types.d.ts +0 -65
- package/lib-amd/components/Button/Button.types.js +0 -5
- package/lib-amd/components/Button/Button.types.js.map +0 -1
- package/lib-amd/components/Button/index.d.ts +0 -6
- package/lib-amd/components/Button/index.js +0 -10
- package/lib-amd/components/Button/index.js.map +0 -1
- package/lib-amd/components/Button/renderButton.d.ts +0 -5
- package/lib-amd/components/Button/renderButton.js +0 -16
- package/lib-amd/components/Button/renderButton.js.map +0 -1
- package/lib-amd/components/Button/useButton.d.ts +0 -10
- package/lib-amd/components/Button/useButton.js +0 -28
- package/lib-amd/components/Button/useButton.js.map +0 -1
- package/lib-amd/components/Button/useButtonState.d.ts +0 -6
- package/lib-amd/components/Button/useButtonState.js +0 -48
- package/lib-amd/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/components/Button/useButtonStyles.d.ts +0 -4
- package/lib-amd/components/Button/useButtonStyles.js +0 -385
- package/lib-amd/components/Button/useButtonStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +0 -6
- package/lib-commonjs/components/Button/useButtonState.js +0 -47
- package/lib-commonjs/components/Button/useButtonState.js.map +0 -1
- package/src/components/Button/Button.types.ts +0 -120
package/README.md
CHANGED
@@ -2,124 +2,35 @@
|
|
2
2
|
|
3
3
|
**Button components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
|
4
4
|
|
5
|
-
|
5
|
+
The Button component enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
|
6
6
|
|
7
|
-
|
7
|
+
## STATUS: WIP 🚧
|
8
8
|
|
9
|
-
|
10
|
-
import { Button } from '@fluentui/react-button';
|
11
|
-
|
12
|
-
const App = () => {
|
13
|
-
return <Button content="hello, world!" />;
|
14
|
-
};
|
15
|
-
```
|
16
|
-
|
17
|
-
## Migration guide
|
18
|
-
|
19
|
-
The Button has been completely rewritten to be faster, smaller, and easier to customize compared to the version from `office-ui-fabric-react@7`. By default, Buttons now have no opinion about icons, menuing, or split button behavior, which has led to large bundle and performance hits for the most common cases in the past.
|
20
|
-
|
21
|
-
### Component renames
|
22
|
-
|
23
|
-
Common buttons now all map to `Button`:
|
24
|
-
|
25
|
-
| Old | New |
|
26
|
-
| ------------------------------------------------ | ------------------------------------------------------------- |
|
27
|
-
| `<DefaultButton text="Hello, world" />` | `<Button>Hello, world</Button>` |
|
28
|
-
| `<PrimaryButton text="Hello, world" />` | `<Button primary>Hello, world</Button>` |
|
29
|
-
| `<IconButton iconProps={{ iconName: 'Add' }} />` | `<Button iconOnly subtle icon={ <Icon iconName="Add" /> } />` |
|
30
|
-
|
31
|
-
### Toggle buttons
|
32
|
-
|
33
|
-
The `ToggleButton` component is an extension of the `Button` and has been separated out to reduce bundle size and performance overhead. The `ToggleButton` respects a `checked` or `defaultChecked` flag.
|
34
|
-
|
35
|
-
```jsx
|
36
|
-
const App = () => {
|
37
|
-
const [isChecked, setChecked] = React.useState(false);
|
38
|
-
|
39
|
-
return (
|
40
|
-
<ToggleButton checked={checked} onClick={() => setChecked(!isChecked)}>
|
41
|
-
{checked ? 'Pause' : 'Play'}
|
42
|
-
</ToggleButton>
|
43
|
-
);
|
44
|
-
};
|
45
|
-
```
|
46
|
-
|
47
|
-
### Menu buttons
|
48
|
-
|
49
|
-
The `MenuButton` component is an extension of the `Button` and has been separated out to reduce bundle size and performance overhead. The `MenuButton` takes in a `menu` prop to provide the menu:
|
50
|
-
|
51
|
-
```jsx
|
52
|
-
const App = () => {
|
53
|
-
const [ isChecked, setChecked ] = React.useState(false);
|
54
|
-
|
55
|
-
return (
|
56
|
-
<MenuButton
|
57
|
-
iconOnly
|
58
|
-
circular
|
59
|
-
subtle
|
60
|
-
icon={ <EllipsisIcon /> }
|
61
|
-
menu={
|
62
|
-
items: [
|
63
|
-
{ key: 'a', ... }
|
64
|
-
]
|
65
|
-
}
|
66
|
-
/>
|
67
|
-
);
|
68
|
-
}
|
69
|
-
```
|
70
|
-
|
71
|
-
### Split menu buttons
|
72
|
-
|
73
|
-
The `SplitButton` is now its own component, instead of being baked into the `Button` component itself. This helps to overall reduce the default `Button` complexity, runtime overhead, and bundle size:
|
9
|
+
These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
|
74
10
|
|
75
|
-
|
76
|
-
|
77
|
-
```jsx
|
78
|
-
<PrimaryButton split onClick={ () => alert('action')} menuProps={{ items: [ ... ] }} text="Hello, world" />
|
79
|
-
```
|
11
|
+
## Usage
|
80
12
|
|
81
|
-
|
13
|
+
To import Button:
|
82
14
|
|
83
|
-
```
|
84
|
-
|
15
|
+
```js
|
16
|
+
import { Button } from '@fluentui/react-button';
|
85
17
|
```
|
86
18
|
|
87
|
-
|
88
|
-
|
89
|
-
- Now 2 tab targets rather than 1: The action part of the button and the menu part are now separate focus targets. This helps with predictability for users who want to either execute the action or expand the menu. It also helps with accessibility, as we can keep the action with a normal `button` role, and the menu with an `aria-haspopup` attribute, making it more clear for screen readers to differentiate from a typical menu button.
|
19
|
+
Once the Button component graduates to a production release, the component will be available at:
|
90
20
|
|
91
|
-
|
92
|
-
|
93
|
-
Buttons now support slots. Slot support replaces `onRender*` and `*Props` props. The `iconProps` is an example of this. Before, you would provide the props directly. Now you can provide JSX, which lets the implementation own prop typing:
|
94
|
-
|
95
|
-
Before:
|
96
|
-
|
97
|
-
```jsx
|
98
|
-
<DefaultButton iconProps={{ iconName: 'Add' }}> />
|
21
|
+
```js
|
22
|
+
import { Button } from '@fluentui/react-components';
|
99
23
|
```
|
100
24
|
|
101
|
-
|
25
|
+
### Examples
|
102
26
|
|
103
27
|
```jsx
|
104
|
-
<Button
|
28
|
+
<Button>Text</Button>
|
29
|
+
<Button icon={<SVGIcon />} />
|
30
|
+
<Button icon={<SVGIcon />}>Text</Button>
|
31
|
+
<Button icon={<SVGIcon />} iconPosition="after">Text</Button>
|
32
|
+
<Button primary>Text</Button>
|
33
|
+
<Button disabled>Text</Button>
|
34
|
+
<Button size="small">Text</Button>
|
35
|
+
<Button size="large">Text</Button>
|
105
36
|
```
|
106
|
-
|
107
|
-
This ensures that `Button` components work not just with Fluent UI icons, but with any other icon set.
|
108
|
-
|
109
|
-
### Additional button modifiers and enums
|
110
|
-
|
111
|
-
These all apply to `Button`, `ToggleButton`, `MenuButton`, and `SplitButton`:
|
112
|
-
| Modifier | Description |
|
113
|
-
| ---------- | --------------------------------------------------------------------------------------- |
|
114
|
-
| `block` | Stretches the button to the container width. |
|
115
|
-
| `circular` | Make the button rounded on the edges (pill button.) |
|
116
|
-
| `iconOnly` | Makes the width match the height. Can be combined with circular to make circle buttons. |
|
117
|
-
| `subtle` | Makes the button inherit the background color. |
|
118
|
-
| `primary` | Uses the brand color to indicate the button is a primary action. |
|
119
|
-
| `size` | Controls the size of the button, based on an enum value: `smallest`, `smaller`, `small`, `regular`, `large`, `larger`, `largest`. Defaults to `regular`. |
|
120
|
-
|
121
|
-
### Styling changes
|
122
|
-
|
123
|
-
- `vertical-align` is now set to `middle` to ensure they align correctly. See https://codesandbox.io/s/align-buttons-middle-6u5nu for an example of why this is important.
|
124
|
-
- Focus rectangles have been adjusted to be more visible and consistent with our new focus styling approach (note that not everything has been updated to the 2px black border 1px inverted inner.)
|
125
|
-
- Gaps between elements within the button were changed to margins rather than combo of padding/margin.
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html dir="ltr" lang="en-us">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" user-scalable="no" />
|
7
|
+
<title>Fluent UI React Examples</title>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body>
|
11
|
+
<div id="content"></div>
|
12
|
+
<script type="text/javascript">
|
13
|
+
// @ts-check
|
14
|
+
window.FabricConfig = {
|
15
|
+
// Uncommenting this prevents the fontfaces from being registered.
|
16
|
+
// Alternatively you can specify a base url which contains the font/icon assets.
|
17
|
+
// fontBaseUrl: '',
|
18
|
+
// mergeStyles: {
|
19
|
+
// injectionMode: 2
|
20
|
+
// }
|
21
|
+
};
|
22
|
+
|
23
|
+
var isLocal = ['localhost', '[::]', '127.0.0.1'].indexOf(location.hostname) !== -1;
|
24
|
+
|
25
|
+
var isDev = getParameterByName('dev') === '1' || !!getParameterByName('strict');
|
26
|
+
var minParam = getParameterByName('min');
|
27
|
+
var useMinified =
|
28
|
+
!isDev && minParam !== '0' && (minParam === '1' || location.pathname === '/fabric-react/master/');
|
29
|
+
|
30
|
+
function loadScript(n) {
|
31
|
+
for (var i = 0; i < n.length; i++) {
|
32
|
+
var s = document.createElement('script');
|
33
|
+
s.src = n[i];
|
34
|
+
s.async = false;
|
35
|
+
document.body.appendChild(s);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const scripts = [];
|
40
|
+
|
41
|
+
if (isLocal) {
|
42
|
+
scripts.push('./react.development.js');
|
43
|
+
scripts.push('./react-dom.development.js');
|
44
|
+
} else {
|
45
|
+
const reactVersion = isDev ? 'development.js' : 'production.min.js';
|
46
|
+
scripts.push('//cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.' + reactVersion);
|
47
|
+
scripts.push('//cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.' + reactVersion);
|
48
|
+
}
|
49
|
+
|
50
|
+
if (useMinified) {
|
51
|
+
scripts.push('demo-app.min.js');
|
52
|
+
} else {
|
53
|
+
scripts.push('demo-app.js');
|
54
|
+
}
|
55
|
+
|
56
|
+
loadScript(scripts);
|
57
|
+
|
58
|
+
function getParameterByName(name, url) {
|
59
|
+
if (!url) {
|
60
|
+
url = location.href;
|
61
|
+
}
|
62
|
+
name = name.replace(/[\[\]]/g, '\\$&');
|
63
|
+
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
|
64
|
+
results = regex.exec(url);
|
65
|
+
if (!results) return null;
|
66
|
+
if (!results[2]) return '';
|
67
|
+
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
68
|
+
}
|
69
|
+
</script>
|
70
|
+
</body>
|
71
|
+
</html>
|