Skip to content
A zero-dependency React Hook to show the brand from a card type.
TypeScript JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
package.json
rollup.config.js
tsconfig.json
tslint.json
yarn.lock

README.md

React Card Brand

A zero-dependency React Hook to show the brand from a card type.

Installation

$ npm i -S react-card-brand

or install with Yarn if you prefer:

yarn add react-card-brand

Usage

You can import useCardBrand into your component and use the getSvgProps callback to get a current brand from your card type.

import React from 'react';
import { useCardBrand, images } from 'react-card-brand';

export default function Example() {
  const { getSvgProps } = useCardBrand();

  return (
    <div>
      <svg {...getSvgProps({ type: "visa", images })} />
    </div>
  );
}

Community

All feedback and suggestions are welcome!

License

This is a open-source software licensed under the MIT license

You can’t perform that action at this time.