In the short term, the new Button
control is named ButtonV1
while it clashes with the existing older control. Once we deprecate the old control, it will be renamed to Button
. It may be useful to rename the control to Button
using the import syntax to simplify the rename:
import { ButtonV1 as Button } from '@fluentui-react-native/button'
Primary and Stealth buttons now map to Button
:
v0 Button |
v1 Button |
---|---|
<Button content="Hello, world" /> |
<Button>Hello, world</Button> |
<PrimaryButton content="Hello, world" /> |
<Button appearance='primary'>Hello, world</Button> |
<StealthButton content="Hello, world" /> |
<Button appearance='subtle'>Hello, world</Button> |
- Any props that are part of
ViewProps
children
componentRef
icon
onClick
testID
tooltip
content
=> Pass the content aschildren
insteadendIcon
=> Useafter
value foriconPosition
prop and pass icon information intoicon
prop insteadstartIcon
=> Usebefore
value foriconPosition
prop and pass icon information intoicon
prop instead
- Cannot use both
startIcon
andendIcon
at the same time in v1
- Any props that are part of
FontTokens
,IForegroundColorTokens
,IBackgroundColorTokens
,IBorderTokens
iconColor
iconSize
iconWeight
contentPadding
=> Set onstyle
property ofroot
property underslotProps
incompose
APIiconColorHovered
=> UseiconColor
token under thehovered
state tokeniconColorPressed
=> UseiconColor
token under thepressed
state token
contentPaddingFocused
=> Removed in favor of using native based focus visualswrapperBorderColor
=> Removed in favor of using native based focus visuals
borderWrapper
has been removed in favor of using native focus visuals. Useroot
instead.stack
has been removed. Useroot
instead.
If you are using the older theme provider ThemeProvider
from @uifabricshared/theming-react-native
, you will need to update the ThemeProvider
to pull from @fluentui-react-native/theme
to have the control work properly with themes. Please see this page for guidance.
Please see this page for guidance on how to move from the old customize
API to the new one.
If you were using PrimaryButton
or StealthButton
, any color customizations will need to be applied under the primary
and subtle
tokens, respectively:
const Custom = StealthButton.customize({
tokens: {
borderWidth: 0,
color: 'white',
backgroundColor: 'red',
}
});
would become
const Custom = Button.customize({
subtle: {
borderWidth: 0,
color: 'white',
backgroundColor: 'red',
}
});
Please see this page for guidance on how to move from the old customize
API to the new one.
The FURN button cannot be used in place of a FluentUI button - these buttons are intended to be used on their respective platforms. See this porting guide for general guidance on coming from FluentUI to FURN.
children
disabled
icon
onClick
testID
tooltip
No Button
specific renames.
icon
takes in a props object instead of the JSX element itself. This is due to framework differences from FluentUI.iconOnly
must be supplied for components do not have any text content for them to be styled correctly. This is due to framework differences from FluentUI.ref
is exposed ascomponentRef
, similar to previous versions of FluentUI. This is due to framework differences from FluentUI.
appearance
does not include values fortransparent
oroutline
as neither currently are used by native platforms.iconPosition
usesbefore
andafter
as values instead ofleft
andright
for better right to left support.
v0 Button |
v1 Button |
---|---|
componentRef |
componentRef |
content |
|
disabled |
disabled |
endIcon |
iconPosition |
icon |
icon |
onClick |
onClick |
statIcon |
iconPosition |
testId |
testId |
tooltip |
tooltip |