RNJet LogoRNJet
Components

Button

Theme-aware, variant-driven button component for RNJet.

Button

A versatile, theme-aware button with built-in support for outline, danger, success, and disabled variants — plus optional icons and fully customizable styling.


Props

Core

PropTypeDefaultDescription
labelstringButton text
action() => voidCallback fired on press
childrenReactNodeCustom content — replaces label when provided
testIDstringTest identifier for e2e testing

Variants

PropTypeDefaultDescription
outlinebooleanfalseRenders a bordered button with transparent background
dangerbooleanfalseUses danger.base as the background color
successbooleanfalseUses success.base as the background color
primaryLightbooleanfalseUses primary.base as background with neutral.base text

Variant priority (highest → lowest): isDisabledoutlinedangersuccessprimaryLightbackground.

Icons

PropTypeDefaultDescription
iconanyImage source rendered to the left of the label (via Image)
iconLeftanyCustom element rendered to the left of the label (via View)

Styling

PropTypeDefaultDescription
colorstringtheme.whiteText color
backgroundstringtheme.primary.baseBackground color (when no variant is active)
fontSizenumber16Font size for the label
borderColorstringtheme.neutral.baseBorder color
borderWidthnumber0Border width (auto-set to 1 for outline)
paddingViewStyle['padding']Custom padding override
marginViewStyle['margin']Custom margin override
topnumber0marginTop shorthand
bottomnumber0marginBottom shorthand
styleTouchableOpacityProps['style']{}Additional styles merged into the container
textStyleStyleProp<TextStyle>Additional styles merged into the label

State

PropTypeDefaultDescription
isDisabledbooleanfalseDisables the button and applies disabled styling
customDisabledbooleanfalseDisables press without changing the visual appearance

Usage

Primary button:

<Button label="Continue" action={handleContinue} />

Outline button:

<Button label="Cancel" outline action={handleCancel} />

Danger button:

<Button label="Delete Account" danger action={handleDelete} />

Success button:

<Button label="Confirm" success action={handleConfirm} />

Disabled button:

<Button label="Submit" isDisabled action={handleSubmit} />

With left icon (image source):

<Button
  label="Sign in with Google"
  icon={require("@assets/google.png")}
  action={handleGoogleSignIn}
/>

With left icon (custom element):

<Button
  label="Add to Cart"
  iconLeft={<MaterialDesignIcons name="cart" size={20} color="white" />}
  action={handleAddToCart}
/>

Custom children:

<Button action={handlePress}>
  <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
    <Icon name="star" />
    <Text>Custom Content</Text>
  </View>
</Button>

When children is provided, it completely replaces the default label text.

Custom colors:

<Button
  label="Special"
  color="#FFFFFF"
  background="#6C63FF"
  action={handlePress}
/>

With spacing:

<Button label="Next" top={16} bottom={8} action={handleNext} />

Variants

The button's background and text colors change depending on which variant prop is active:

VariantBackgroundText ColorBorder
(default)background propcolor propnone
outlinetransparentneutral.baseneutral.base (1px)
dangerdanger.basewhitenone
successsuccess.basewhitenone
primaryLightprimary.baseneutral.basenone
isDisabledneutral.disabledneutral.secondarynone

Disabled States

The component supports two types of disabled behavior:

PropVisually disabled?Press disabled?Use case
isDisabledStandard disabled state with grayed-out styling
customDisabledBlock interaction while keeping the styled look (e.g. during loading)

Both props disable onPress via TouchableOpacity's disabled prop.


Notes

  • borderRadius is always 12
  • Font is Montserrat-Bold with fontWeight: '600'
  • allowFontScaling is false — prevents system font size from affecting button text
  • The icon prop expects an image source (used with Image), while iconLeft accepts any React element (used with View)
  • The children prop takes priority over label — when provided, only children is rendered

On this page