Composable Moov Drops
The composable Drops are a collection of interconnected elements, including moov-form, moov-text-input, moov-card-number-input, and other fields. By combining these elements, your users can interact directly with the Moov API, keeping sensitive data away from your app and simplifying PCI compliance. Need to update a user's credit card information? Combine a moov-form with a moov-card-number-input and Moov takes care of the rest.
Use the Drops 101 guide to learn the basics of properties, attributes, and initializing Drops.
<!-- The moov-form makes the secure call to Moov -->
<moov-form
name="demo-form"
method="PATCH"
action="/accounts/{accountID}/cards/{cardID}"
></moov-form>
<script>
const form = document.querySelector("moov-form");
form.requestHeaders = {
"content-type": "application/json",
"Authorization": "Bearer <moov-api-token>",
};
</script>
<section>
<label>Name on card</label>
<!-- The moov-text-input element allows a user to update a cardholder's name -->
<moov-text-input
formname="demo-form"
name="holderName"
autocomplete="cc-name"
></moov-text-input>
<label>Card number</label>
<!-- The moov-card-number-input element allows a user to update a card's number -->
<moov-card-number-input
formname="demo-form"
name="cardNumber"
required
></moov-card-number-input>
<label>Expiration date</label>
<!-- The moov-expiration-date-input element allows a user to update a card's expiration date -->
<moov-expiration-date-input
formname="demo-form"
name="expiration"
required
></moov-expiration-date-input>
<label>CVV</label>
<!-- The moov-card-security-code-input element allows a user to update a card's CVV -->
<moov-card-security-code-input
formname="demo-form"
name="cardCvv"
></moov-card-security-code-input>
<label>ZIP code:</label>
<!-- The moov-text-input element allows a user to update a card's billing ZIP -->
<moov-text-input
formname="demo-form"
name="billingAddress.postalCode"
autocomplete="postal-code"
></moov-text-input>
</section>
Theming & styles
The composable Drop inputs will automatically style themselves based on inheritable <input> styles, such as font-size, color, and line-height.
You can further customize the outer contents of an element by targeting the element's tag, such as moov-text-input, and applying additional styles. To re-style the inner contents of an element, use the inputStyle property.
Note: Pseudo-selectors such as :focus and :valid don't work through iframes. Instead, use :has(.focus) to apply styles to these pseudo-classes. All input pseudo-classes are supported.
moov-text-input:has(.focus) {
border-color: var(--focus-color);
}
moov-text-input + .myErrorMessage {
display: none;
}
moov-text-input:has(.user-invalid) + .myErrorMessage {
display: block;
color: red;
}
Properties
Properties for elements can be accessed through JavaScript using a reference to the specific form element.
- View
moov-formproperties - View
moov-text-inputproperties - View
moov-card-number-inputproperties - View
moov-expiration-date-inputproperties - View
moov-card-security-code-inputproperties
Attributes
Any string-type property can alternatively be set via attributes:
- View
moov-formattributes - View
moov-text-inputattributes - View
moov-card-number-inputattributes - View
moov-expiration-date-inputattributes - View
moov-card-security-code-inputattributes
Moov form
The Moov form Drop wraps composable input Drops and submits the sensitive data they collect directly to a Moov API endpoint from the browser.
Text input
Use the text input Drop inside a Moov form Drop to securely collect free-form sensitive user data, such as names or addresses, and send it to Moov.
Card number input
Include the Moov card number input Drop with the Moov form Drop to securely and seamlessly submit sensitive card numbers to Moov.
Expiration date input
Include the Moov expiration date input Drop with the Moov form Drop to securely and seamlessly submit sensitive card data to Moov.
Card security code input
Include the Moov security code input Drop with the Moov form Drop to securely and seamlessly submit sensitive card data to Moov.