Skip to content
Last updated

Style Guide

The Tyro.js library can be customized during createPayForm(config) 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 pixel representation string e.g. "10px" or "10"
  • Padding supports a mix of sizes as per HTML markup specifications e.g. "10px", "10px 20px" or "10px 20px 5px 10px"
  • Font weights are per hundred as per HTML markup specifications e.g. "400", "600" or "800"

You can configure and experiment with styleProps using the Try It Out feature.

Visual Style Guide

Visual Style Guide

Implementation

// Javascript sample code
const payForm = tyro.createPayForm({
  theme: 'sharp',
  styleProps: {
    /* Example custom styles
    bodyBackgroundColor: "#F2F2F2",
    bodyPadding: "10px 20px",
    inputFontSize: "16px",
    labelFontWeight: "600",
    showErrorSpacing: false,
    */
  }
});

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.​walletPaymentsButtonsHeightstring

Optional height property for the wallet payments buttons.

styleProps.​walletPaymentsButtonsMarginstring

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

styleProps.​walletPaymentsButtonsGapstring

Optional gap or space that applies around multiple buttons when present. Defaults to 20px.

styleProps.​walletPaymentsButtonsAlignstring

Optional property to set the wallet payment buttons alignment. Defaults to CENTER. You must specify a fixed walletPaymentsButtonsWidth for this properties to take effect.

Enum"LEFT""RIGHT""CENTER"
styleProps.​walletPaymentsButtonsStackingstring

Optional property to set how multiple wallet payment buttons should be positioned on the form. Defaults to HORIZONTAL. Note: Will be forced to VERTICAL under 380px screen resolution.

Enum"HORIZONTAL""VERTICAL"
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. Defaults to system font.

Enum"arial""roboto""serif"
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.​inputFontLetterSpacingstring

The font letter spacing 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""inline"
styleProps.​labelFontColorstring

The font color of a label.

styleProps.​labelFontSizestring

The font size of a label.

styleProps.​labelFontLetterSpacingstring

The font letter spacing size a label.

styleProps.​labelFontWeightstring

The font weight of a label.

styleProps.​labelPaddingstring

The padding inside a label.

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.​errorFontLetterSpacingstring

The font letter spacing size 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.