Skip to main content

FloatButton floating button component

Effect demonstration

1. The floating button is in the upper right corner of the page

<FloatButton
verticalOrientation="down"
items={[
{
backgroundColor: "#9b59b6",
title: "Notifications",
icon: <SvgIcon name="bells" size={24} color={"white"} />,
},
{
backgroundColor: "#3498db",
title: "Reload",
icon: <SvgIcon name="reload" size={24} color={"white"} />,
},
{
backgroundColor: "#1abc9c",
title: "All Tasks Done",
icon: <SvgIcon name="checkcircle" size={24} color={"white"} />,
},
]}
/>

2. Custom style

<FloatButton
buttonColor="rgba(231,76,60,1)"
btnOutRange="gold"
position="left"
verticalOrientation="down"
spacing={10}
items={[
{
backgroundColor: "#9b59b6",
title: "Notifications",
icon: <SvgIcon name="bells" size={24} color={"white"} />,
},
{
backgroundColor: "#3498db",
title: "Reload",
icon: <SvgIcon name="reload" size={24} color={"white"} />,
},
{
backgroundColor: "#1abc9c",
title: "All Tasks Done",
icon: <SvgIcon name="checkcircle" size={24} color={"white"} />,
},
]}
/>

3. Custom floating button

<FloatButton
buttonColor="gold"
btnOutRange="red"
position="right"
verticalOrientation="down"
customIcon={<SvgIcon name="checkboxHalfchecked" color="white" size={25} />}
items={[
{
backgroundColor: "#9b59b6",
title: "Notifications",
icon: <SvgIcon name="bells" size={24} color={"white"} />,
},
{
backgroundColor: "#3498db",
title: "Reload",
icon: <SvgIcon name="reload" size={24} color={"white"} />,
},
{
backgroundColor: "#1abc9c",
title: "All Tasks Done",
icon: <SvgIcon name="checkcircle" size={24} color={"white"} />,
},
]}
/>
floatButton-ios4.gif

API

FloatButton

PropertiesRequiredDescriptionTypeDefault Value
itemstrueExpand button groupActionButtonItemProps[]
sizefalseThe size of the main buttonnumber40
verticalOrientationfalseExpand directionup | downup
buttonColorfalseThe color of the buttonstringblack
btnOutRangefalseThe color of the button after clickingstringblack
outRangeScalefalseThe scaling ratio of the main button during animationnumber1
customIconfalseCustomize the icon of the main buttonReactNode
positionfalseThe position of the main buttonleft | center | rightright
spacingfalseSpacing between expand buttonsnumber8
stylefalseThe style of the entire containerViewStyle
activeOpacityfalseOpacity when pressednumber0.6

ActionButtonItemProps

PropertiesRequiredDescriptionTypeDefault Value
icontruebutton iconReactElement
backgroundColortrueThe color of the buttonstring
onPressfalseButton click event() => void
textStylefalseThe text style of the buttonTextStyle
textContainerStylefalseThe text container style of the buttonViewStyle
titlefalseThe text title of the buttonstring
spaceBetweenfalseSpacing between buttons and iconsnumber4