Skip to main content

Button Component

The Button component is a customizable, reusable React Native button that supports various styles, sizes, and states. It's designed to be flexible and can be used across different parts of the application.

Key Features

  • Customizable appearance (filled or outline)
  • Multiple size options (sm, lg, xl, default)
  • Loading state with activity indicator
  • Disabled state
  • Custom colors for button and text
  • Custom font type support
  • Accessibility support via testId

Props

PropTypeDescription
titlestringThe text displayed on the button
onPress() => voidFunction called when the button is pressed
buttonStyleViewStyleCustom styles for the button container
textStyleTextStyleCustom styles for the button text
isLoadingbooleanWhether to show a loading indicator
isOutlinebooleanWhether to use an outline style
activityIndicatorColorstringColor of the loading indicator
size'sm' | 'lg' | 'xl' | 'default'Size of the button
colorstring | undefinedBackground color of the button
textColorstringColor of the button text
fontTypestringFont family for the button text
testIdstringTest ID for accessibility
disabledbooleanWhether the button is disabled

Usage

import { Button } from "@appmaker-xyz/ui";

<Button
title="Press Me"
onPress={() => console.log("Button pressed")}
size="lg"
color="#007AFF"
isOutline={false}
isLoading={false}
/>;