1.0.22 • Published 3 years ago

react-credit-card-flipping v1.0.22

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

React Credit Card Flipping

Credit card flipping for ReactJS

Demo

Install

   npm install react-credit-card-flipping

ou

yarn add react-credit-card-flipping

Usage

import React, { useState } from 'react';
import Card from 'react-credit-card-flipping';

export default function App() {
  const [cardNumber, setCardNumber] = useState('');
  const [cardName, setCardName] = useState('');
  const [cardBrand, setCardBrand] = useState('');
  const [cardExpiry, setCardExpiry] = useState('');
  const [cardCVV, setCardCVV] = useState('');
  const [focusCVV, setFocusCVV] = useState(false);

  return (
    <div id="form">
      <Card
        number={cardNumber}
        name={cardName}
        expiry={cardExpiry}
        cvv={cardCVV}
        flipCard={focusCVV}
      />
      <form>
        <input
          type="tel"
          name="number"
          placeholder="Card Number"
          onChange={(event) => setCardNumber(event.target.value)}
        />
        ...
        <input
          type="tel"
          name="cvv"
          placeholder="CVV"
          onChange={(event) => setCardCVV(event.target.value)}
          onFocus={() => setFocusCVV(true)}
          onBlur={() => setFocusCVV(false)}
        />
      </form>
    </div>
  );
}

Props

propertypropTyperequireddefaultdescription
namestringyesCardholder Name
numberstring | numberyesCard number
expirystringyesCard expiry date 00/00
cvvstring | numberyesCard CVC/CVV
brandstringyesCard brand URL
backgroundColorstring-#DDDCard background color when empty
filledBackgroundColorstring-#134869Card background color when not empty
flipCardboolean-falseFlip card when there`s focus or blur on CVV input
emptyNamestring-Cardholder NameDefault value when name is empty

LICENSE

This project is licensed under the MIT License.

Development by: André Coelho

1.0.22

3 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago