Back to React Native Paper

FAB

docs/public/4.0/fab.html

5.15.12.3 KB
Original Source

FAB

A floating action button represents the primary action in an application.

Usage

js
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { FAB } from 'react-native-paper';

const MyComponent = () => (
  <FAB
    style={styles.fab}
    small
    icon="plus"
    onPress={() => console.log('Pressed')}
  />
);

const styles = StyleSheet.create({
  fab: {
    position: 'absolute',
    margin: 16,
    right: 0,
    bottom: 0,
  },
})

export default MyComponent;

Props

icon (required) Type: IconSource

Icon to display for the FAB.

label Type: string

Optional label for extended FAB.

uppercase Type: boolean

Default value: true

Make the label text uppercased.

accessibilityLabel Type: string

Default value: label

Accessibility label for the FAB. This is read by the screen reader when the user taps the FAB. Uses label by default if specified.

accessibilityState Type: AccessibilityState

Accessibility state for the FAB. This is read by the screen reader when the user taps the FAB.

animated Type: boolean

Default value: true

Whether an icon change is animated.

small Type: boolean

Whether FAB is mini-sized, used to create visual continuity with other elements. This has no effect if label is specified.

color Type: string

Custom color for the icon and label of the FAB.

disabled Type: boolean

Whether FAB is disabled. A disabled button is greyed out and onPress is not called on touch.

visible Type: boolean

Default value: true

Whether FAB is currently visible.

loading Type: boolean

Whether to show a loading indicator.

onPress Type: () => void

Function to execute on press.

onLongPress Type: () => void

Function to execute on long press.

style Type: StyleProp<ViewStyle>

theme Type: ReactNativePaper.Theme

testID Type: string

Edit this page