A floating action button is a circular icon button that hovers over content to promote a primary action in the application.
import { Fab } from 'native-base';
const Example = () => {
return <Box position="relative" h={100} w="100%">
<Fab position="absolute" size="sm" icon={<Icon color="white" as={<AntDesign name="plus" />} size="sm" />} />
</Box>;
};
const Example = () => {
return <Box h={400} w="100%">
<Fab placement="top-right" icon={<Icon color="white" as={<AntDesign name="plus" />} size={4} />} label={<Text color="white" fontSize="sm">
BUTTON
</Text>} />
</Box>;
};
const Example = () => {
return <Box position="relative" w="100%" h={200}>
<Fab right={70} bottom={50} icon={<Icon color="white" as={<AntDesign name="plus" />} />} />
</Box>;
};
NativeBase ships with a default theme for each component. Check out the default theme of the fab
.
Info:
We can easily extend the fab component theme using extendTheme function as described in the documentation .Fab implements
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
Placement of the Fab
Type: "top-right" | "top-left" | "bottom-right" | "bottom-left"
Text to be displayed in Fab
Icon to be displayed in Fab
Determines whether the Fab should be rendered in a Portal. Refer this solution before using this prop https://github.com/GeekyAnts/NativeBase/issues/3817