Email

Collect the buyer's email address with a secure, fully styleable input.

The Email component (fs-email) renders an email input inside a secure iframe served from FastSpring's domain. The value maps to customer.billToContact.email in the session. The component renders no section header, so add your own heading above it on the page.

This page is the complete reference for the Email component: how to mount it, the options it accepts, the states it exposes for styling, and every style category and property available. For setup context, see the Integration Guide.

Mount

Add a target element to your HTML:

<div id="email-element"></div>

Then create the component from your sdk instance and mount it:

const emailComponent = sdk.components.create('fs-email', {
    // options + style go here
});

emailComponent.mount('#email-element');

Component options

Top-level options passed alongside style:

OptionTypeDefaultDescription
labelMode'floating' | 'fixed''floating'Label placement. 'floating': the label starts inside the input as a placeholder and moves above the field on focus or when filled. 'fixed': the label sits above the input.

How styling works

Styling is configured through a style object passed at component creation. Each state contains one or more style categories (email, label, input, inlineError) that group related properties.

sdk.components.create('fs-email', {
    style: {
        state: {
            default: { /* base styles */ },
            hover:   { /* applied on hover */ },
            focus:   { /* applied on focus */ },
            error:   { /* applied in error state */ },
        },
    },
});

Style precedence: FastSpring uses the first value it finds, in this order:

  1. The style you set for the current state (e.g., state.focus.input)
  2. The style you set for the default state (e.g., state.default.input)
  3. globalStyles passed to FastSpring.init()
  4. FastSpring's built-in default (the Default column in the tables below)

Available states

StateWhen applied
defaultAlways (the base styling)
hoverThe pointer is over the input. No visual change, and overrides under hover are not applied.
focusThe input has keyboard focus
errorThe buyer leaves the field with an invalid address, or clicks Pay while a required field is empty

For what each state changes out of the box, see Default values per state.

Style categories

Each category below targets a specific part of the Email component. Select a card to jump to its full property reference.

The default font family for every category is Helvetica Neue, helvetica, arial, sans-serif, written as Helvetica Neue stack in the tables below.

email: component width

There is no panel around the field: background, border, and shadow come from your page. Text color and font are set per part (label, input, inlineError) or once for every component with globalStyles.

PropertyTypeDefaultDescription
maxWidthstring680pxCaps the width on wide screens. 'none' removes the cap.

input: the email field

PropertyTypeDefaultDescription
backgroundColorstring#ffffffInput background
borderColorstring#DEE2E6Border color
errorBorderColorstring#EB1431Border color in the error state
borderRadiusstring4pxCorner radius
colorstring#4B5563Text color
fontFamilystringHelvetica Neue stackFont family
fontSizestring16pxFont size
fontWeightstring | number400Font weight
heightstring48pxInput height
paddingstring0 16pxInner padding. In floating label mode, the top and bottom padding are 16px and 4px to make room for the label.
marginstring0Outer margin
outlinestringnoneFocus-ring shorthand (e.g., '1px solid #bfdbfe')
outlineColorstringrgba(0, 138, 255, .2)Color of the focus glow
placeholderColorstring#7D8A9BFlat alternative to setting '::placeholder'.color
'::placeholder'object(see description)Nested placeholder styles. Supports color, fontSize, fontFamily, fontWeight. Inner defaults: color: #7D8A9B, fontSize: 16px, fontWeight: 400, Helvetica Neue stack.

label: the field label

PropertyTypeDefaultDescription
colorstring#4B5563Label text color
fontSizestring14pxLabel font size
fontWeightstring | number400Label font weight
fontFamilystringHelvetica Neue stackLabel font family
backgroundColorstringtransparentLabel background
How the floating label looks

In floating mode, the label sits inside the empty input using the placeholder styling (#7D8A9B, 16px). When the field is focused or filled, it moves to the top at .8rem. Under the error state, label.color tints the floating label; by default it follows input.errorBorderColor (#EB1431). In fixed mode, the label stays above the input in label.color, and the empty input shows the placeholder "Enter email address".

inlineError: inline validation error messages

PropertyTypeDefaultDescription
colorstring#EB1431Error message text color
fontSizestring12pxError message font size
fontWeightstring | number400Error message font weight
fontFamilystringHelvetica Neue stackError message font family (follows the component font)
backgroundColorstringtransparentError message background

The error slot reserves 16px of height so the layout doesn't shift when an error appears.

SituationWhen it's shownMessage
Invalid email formatWhen the buyer leaves the field"Enter a valid email address."
Empty field (required)When the buyer clicks Pay"Enter your email address."

Default values per state

Out of the box, the Email component visually changes for focus and error. Only the combinations below can be overridden; others are ignored.

StateWhat you can override
focusinput: borderColor, backgroundColor, outline
errorinput: borderColor, backgroundColor, color · label: color (tints the floating label; follows input.errorBorderColor by default) · inlineError: all properties
hoverNone. Overrides under hover are not applied.

inlineError styling is also accepted under default; the error value wins when both are set.

focus

Applied when the input has keyboard focus.

PropertyDefault override value
input.borderColor#2563EB
Focus glow0 0 0 4px rgba(0, 138, 255, .2) (soft blue glow)
Floating label color#2563EB

error

Applied when validation fails.

PropertyDefault override value
input.errorBorderColor#EB1431
input.color#EB1431
Focus glow0 0 0 4px color-mix(in srgb, #EB1431 25%, transparent)
label.color (floating label)#EB1431

Read-only mode

Applied when fields.email is 'readonly'. This is a mode, not a style state.

PropertyDefault override value
input.backgroundColor#E7E7E7
Focus border and glowTurned off
Floating label on focusStill turns #2563EB

Full example

sdk.components.create('fs-email', {
    labelMode: 'floating',
    style: {
        state: {
            default: {
                email: {
                    maxWidth: '520px',
                },
                label: {
                    color: '#374151',
                    fontSize: '14px',
                    fontFamily: 'Inter, sans-serif',
                },
                input: {
                    fontFamily: 'Inter, sans-serif',
                    backgroundColor: '#f9fafb',
                    borderColor: '#e5e7eb',
                    height: '48px',
                    placeholderColor: '#9ca3af',
                },
                inlineError: {
                    color: '#dc2626',
                    fontSize: '13px',
                },
            },
            focus: {
                input: {
                    borderColor: '#2563eb',
                },
            },
            error: {
                input: {
                    borderColor: '#dc2626',
                },
            },
        },
    },
}).mount('#email-element');