1.0.22 • Published 4 years ago

react-credit-card-flipping v1.0.22

Weekly downloads
2
License
MIT
Repository
github
Last release
4 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

4 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago