[ Web Proxy ]
URL:
Viewing: https://developer.squareup.com/reference/sdks/web/payments/objects/CardClassSelectors [Back]  [Original]

CardClassSelectors Object - Square Web Payments SDK Reference

#
CardClassSelectors

The stylesheet classes assigned to input fields by field state

Use this object to set the appearance of Card input fields by their current focus and input validity state. Note: font size has a maximum of 16px.

Media Queries can be used with valid CardClassSelectors. Syntax support for level 3 features

Properties

#
.input-container Partial<object>

The default style of the Card payment method component

#
.input-container.is-error Partial<object>

The style of the Card payment method component when an input field is in an error state

#
.input-container.is-focus Partial<object>

The style of the Card payment method component when it has focus

#
.message-icon Partial<object>

The style of the input field helper icon

#
.message-icon.is-error Partial<object>

The style of the input field error icon

#
.message-text Partial<object>

The style of the input field helper text

#
.message-text.is-error Partial<object>

The style of the input field error text

#
input Partial<object>

The default style of a Card input field

#
input.is-error Partial<object>

The style of an input field when the field is in an error state

#
input.is-error::placeholder Partial<object>

The style of an input field placeholder when the field is in an error state

#
input.is-focus Partial<object>

The style of an input field that has focus

#
input.is-focus::placeholder Partial<object>

The style of an input field placeholder when the field has focus

#
input::placeholder Partial<object>

The default style of an input field placeholder

cardClassSelectors.js
JS
JavaScript
Copy

const cardClassSelectors = {

   input: {

      backgroundColor: '#F7F8F9',

      color: '#373F4A',

      fontFamily: 'Helvetica Neue',

      fontSize: '16px',

      fontWeight: 'normal'

   },

   'input.is-focus': {

      backgroundColor: '#F7F8F9',

      color: '#3X3F4A',

      fontFamily: 'Helvetica Neue',

      fontSize: '16px',

      fontWeight: 'normal'

   },

   '.input-container': {

      borderColor: 'lightgrey',

      borderWidth: '1px',

   },

   '.input-container.is-focus': {

      borderColor: '#cc0023',

      borderWidth: '0 0 2px 0',

   },

   '.input-container.is-error': {

      borderColor: '#006aff',

      borderWidth: '0 0 2px 0',

   },

   '.message-icon': {

      color: 'green',

   },

   // You can use media queries with valid selectors:

   '@media screen and (max-width: 600px)': {

      input: {

        'fontSize': '12px',

     }

   }

   '@media only screen and (orientation: portrait)': {

     '.message-text': {

       'color': 'transparent',

     }

   }

}

Web Proxy Viewer  |  New URL  |  Original Page