Skip to content

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

License

Notifications You must be signed in to change notification settings

Srreven/react-card-brand

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.0%
  • JavaScript 2.0%