You can now show a visible label above each hosted card field with the showCardFieldLabels prop, change the label text with cardFieldLabels, and style the labels with the .Label rule of appearance.rules. If you mount the card form yourself with @flopay/js, use setShowCardFieldLabels and setCardFieldLabels.
What changed
- Visible labels. With
showCardFieldLabelson, the card number, expiry date, security code and name fields each get a label above them. Labels are off by default, and a label is hidden together with its field. - Your own wording. Pass any of the keys
number,expiry,cvvandnameincardFieldLabelsto replace that label's text. Every key is optional. An empty or missing text shows the default label: "Card number", "Expiry date", "Security code" or "Name on card". - Safe text. The hosted form shows the text literally, never as HTML, and cuts it to 64 characters.
- Label styles. Set
color,fontSize,fontWeight,letterSpacing,textTransformandmarginBottomonappearance.rules['.Label']. A value outside its range is ignored and the default kept. Anything you leave unset follows the form's own text color and font. - Live updates. Turning labels on or off, changing their text or changing their style updates the form without remounting it or clearing what the buyer typed.
What you need to do
Nothing, unless you want labels. Merchants who do not set the props see no change.
The props and the label styles need @flopay/react 1.19.0 or newer, and the methods need @flopay/js 1.19.0 or newer. See Show labels above the card fields for an example and the default text of each label, and Style the card field labels for the range of each style.