Skip to content

MfButton

Themed pressable button with icon support and press feedback.

Usage

tsx
import { MfButton } from '@zyno-io/mobile-foundation-rn';
import { faSave, faArrowRight } from '@fortawesome/free-solid-svg-icons';

// Primary button
<MfButton text="Save" primary onPress={handleSave} />

// Secondary button (default)
<MfButton text="Cancel" onPress={handleCancel} />

// With icon
<MfButton text="Save" icon={faSave} primary onPress={handleSave} />

// Icon trailing
<MfButton text="Next" icon={faArrowRight} iconTrailing onPress={handleNext} />

// Disabled
<MfButton text="Submit" primary disabled />

// Custom children
<MfButton onPress={handlePress}>
    <View style={{ flexDirection: 'row' }}>
        <Text>Custom content</Text>
    </View>
</MfButton>

Props

Extends all standard React Native PressableProps, plus:

PropTypeDefaultDescription
textstringButton label text
primarybooleanfalseUse primary color scheme
feedbackbooleantrueShow opacity feedback on press
disabledbooleanfalseDisable press and reduce opacity
iconIconPropFontAwesome icon
iconColorstringOverride icon color
iconSizenumberOverride icon size
iconTrailingbooleanfalsePlace icon after text
iconStyleFontAwesomeIconStyleAdditional icon styles
childrenReactNodeCustom content (overrides text)

Theming

VariantBackgroundText
PrimaryprimaryButtonBackgroundprimaryButtonText
SecondarysecondaryButtonBackgroundsecondaryButtonText