Skip to main content

FAB.Group

To display a stack of FABs with related actions.

How to use

import React from 'react';
import {FAB, Portal} from '@gyri/native-ui-components';

const MyComponent = ({style, className}) => {
const [state, setState] = React.useState({ open: false });

const onStateChange = ({ open }) => setState({ open });

const { open } = state;

return (
<Portal>
<FAB.Group
style={style}
className={className}
open={open}
visible
icon={open ? 'calendar-today' : 'plus'}
actions={[
{icon: 'plus', onPress: () => console.log('Pressed add')},
{
icon: 'star',
label: 'Star',
onPress: () => console.log('Pressed star'),
},
{
icon: 'email',
label: 'Email',
onPress: () => console.log('Pressed email'),
},
{
icon: 'bell',
label: 'Remind',
onPress: () => console.log('Pressed notifications'),
},
]}
onStateChange={onStateChange}
onPress={() => {
if (open) {
// do something if the speed dial is open
}
}}
/>
</Portal>
)
};

export default MyComponent;

Props

#NameData typeDefault valueValuesDescription
1styleobjectCustom style object
2classNamestring''It defined nativewind style classes.
3iconIcon to display for the FAB.
4colorstringCustom color for the FAB.
5backdropColorstringCustom backdrop color for opened speed dial background.
6rippleColorColor of the ripple effect.
7openbooleanWhether the speed dial is open.
8visiblebooleanWhether FAB is currently visible.
9onStateChangeCallback which is called on opening and closing the speed dial.

For more details https://callstack.github.io/react-native-paper/docs/components/FAB/FABGroup