Skip to content
Last updated

Style Guide

The Tyro React Native component can be customized during the initialization of the <TyroProvider /> to match the look and feel of your site, by using the theme and styleProps configuration properties.

Themes

Fast track your integrations appearance by selecting one of our provided themes.

Styles

To fine-tune individual properties of the visualization, you can use style properties. Style properties will override theme properties.

When using styleProps the following property rules apply, any property that is irregular will be ignored.

  • Any colors, such as background or text, require a Hex color code e.g. "#FFF" or "#FFFFFFF"
  • Sizes such as font, border and size, require a numeric representation but can be supplied as a string e.g. "10" or 10
  • Padding and margins currently only support numeric representation e.g. "10" or 10
  • Font weights are per hundred similar to HTML markup specifications e.g. "400", "800" or 800

Visual Style Guide

Visual Style Guide

Implementation

// example javascript code for using styleProps in the TyroProvider component
import { TyroProvider } from "@tyro/tyro-pay-api-react-native";

const theme = 'default';

const styleProps = {
  bodyBackgroundColor: '#f2f2f2',
  bodyPadding: 10,
  inputFontSize: 16,
  showSupportedCards: false
}

function App() {
  return (
    <TyroProvider
      options={liveMode: false, theme: theme, styleProps: styleProps}
    >
      // Your App Checkout Code wrapped here
    </TyroProvider>
  );
}

Config Parameters

themestring

An optional string to load a set of preset styleProps. Defaults to default.

Enum"default""dark""sharp""minimal"
stylePropsobject

An optional object containing properties for customizing the appearance of the widget.

styleProps.​applePayButtonobject
styleProps.​applePayButton.​buttonBorderRadiusstring

Border radius of the Apple Pay button.

styleProps.​applePayButton.​buttonStylestring

Style of the Apple Pay button. Defaults to black.

Enum"black""white""white-outline"
styleProps.​applePayButton.​buttonTypestring

Type of the Apple Pay button. Setting this property will add text to the Apple Pay button based on the type chosen. Defaults to plain.

Enum"plain""pay""buy""order""book""check-out""continue""add-money""contribute""donate"
styleProps.​googlePayButtonobject
styleProps.​googlePayButton.​buttonColorstring

Style of the Google Pay button. Defaults to default.

Enum"black""white""default"
styleProps.​googlePayButton.​buttonTypestring

Type of the Google Pay button. Setting this property will add text to the Google Pay button based on the type chosen. Defaults to buy.

Enum"book""buy""checkout""donate""order""pay""plain""subscribe"
styleProps.​walletPaymentsDividerTextstring

Optional text to show in the wallet payments divider. Default is "Or pay with card". Empty is allowed.

styleProps.​walletPaymentsDividerEnabledboolean

Optional flag to enable or disable the wallet payments divider. Defaults to true.

styleProps.​walletPaymentsButtonsWidthstring

Optional width property for the wallet payments buttons.

styleProps.​walletPaymentsButtonsMarginstring

Optional margin property for spacing around the wallet payment buttons. Defaults to 8px.

styleProps.​bodyBackgroundColorstring

The background color of the widget.

styleProps.​bodyPaddingstring

The padding around the widget.

styleProps.​bodyWidthstring

The width of the iframe. Defaults to 100%.

styleProps.​bodyMinWidthstring

The minimum width of the iframe. Defaults to 500px.

styleProps.​bodyMaxWidthstring

The maximum width of the iframe. Defaults to 780px.

styleProps.​fontFamilystring

The font family of all text inside the widget. Supports custom fonts. Defaults to system font.

styleProps.​inputBackgroundColorstring

The background color of an input field.

styleProps.​inputBorderColorstring

The border color of an input field.

styleProps.​inputBorderSizestring

The border thickness of an input field.

styleProps.​inputBorderRadiusstring

The border radius of all corners of an input field.

styleProps.​inputFontColorstring

The font color of text inside an input field.

styleProps.​inputFontSizestring

The font size of text inside an input field.

styleProps.​inputFontWeightstring

The font weight of text inside an input field.

styleProps.​inputErrorFontColorstring

The font color of text inside an input field when it is in an invalid state.

styleProps.​inputErrorBorderColorstring

The border color of an input field when it is in an invalid state.

styleProps.​inputErrorBorderSizestring

The border thickness of an input field when it is in an invalid state.

styleProps.​inputFocusBackgroundColorstring

The background color of an input field when it is focused.

styleProps.​inputFocusBorderColorstring

The border color of an input field when it is focused.

styleProps.​inputFocusBorderSizestring

The border thickness of an input field when it is focused.

styleProps.​inputFocusFontColorstring

The font color of text inside an input field when it is focused.

styleProps.​inputPaddingstring

The padding inside an input field.

styleProps.​inputSpacingstring

The amount of vertical space between inputs, irrespective of error messages.

styleProps.​labelPositionstring

The label position relative to the input field.

Enum"block""floating"
styleProps.​labelFontColorstring

The font color of a label. labelPosition must = block for this to have effect.

styleProps.​labelFontSizestring

The font size of a label. labelPosition must = block for this to have effect.

styleProps.​labelFontWeightstring

The font weight of a label. labelPosition must = block for this to have effect.

styleProps.​labelPaddingstring

The padding inside a label. labelPosition must = block for this to have effect.

styleProps.​errorBackgroundColorstring

The background color of an error message.

styleProps.​errorFontColorstring

The font color of an error message.

styleProps.​errorFontSizestring

The font size of an error message.

styleProps.​errorFontWeightstring

The font weight on an error message.

styleProps.​errorPaddingstring

The padding inside an error message.

styleProps.​showCardIconboolean

Will display a visual aid card brand icon, and security code helper icon in the respective inputs. Defaults to true.

styleProps.​showErrorSpacingboolean

Reserves space equal to the size of the error message under each field. Defaults to true.

styleProps.​showSupportedCardsboolean

Will show a list of supported card types. Defaults to true.