{"id":13397432,"url":"https://github.com/jessepollak/card","last_synced_at":"2025-05-11T03:39:03.403Z","repository":{"id":12791062,"uuid":"15464772","full_name":"jessepollak/card","owner":"jessepollak","description":":credit_card: make your credit card form better in one line of code","archived":false,"fork":false,"pushed_at":"2023-06-12T08:56:41.000Z","size":2274,"stargazers_count":11692,"open_issues_count":65,"forks_count":1479,"subscribers_count":235,"default_branch":"master","last_synced_at":"2025-05-08T22:37:45.509Z","etag":null,"topics":["coffeescript","credit-card","css","javascript","jquery","payments"],"latest_commit_sha":null,"homepage":"","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jessepollak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-12-27T02:31:51.000Z","updated_at":"2025-05-08T18:34:47.000Z","dependencies_parsed_at":"2023-02-13T21:17:09.918Z","dependency_job_id":"b1aab98b-f12e-4d89-8c2a-aab43f546729","html_url":"https://github.com/jessepollak/card","commit_stats":{"total_commits":412,"total_committers":81,"mean_commits":5.08641975308642,"dds":0.6553398058252426,"last_synced_commit":"fb006e9773b5175152a29bb6f8d97294fabf609f"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessepollak%2Fcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessepollak%2Fcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessepollak%2Fcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessepollak%2Fcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jessepollak","download_url":"https://codeload.github.com/jessepollak/card/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166473,"owners_count":21864467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coffeescript","credit-card","css","javascript","jquery","payments"],"created_at":"2024-07-30T18:01:23.454Z","updated_at":"2025-05-11T03:39:03.376Z","avatar_url":"https://github.com/jessepollak.png","language":"SCSS","readme":"![npm](https://img.shields.io/npm/v/card)\n\n# Card - check out the **[demo](https://jessepollak.github.io/card)**\n\n### A better credit card form in one line of code\n\nCard will take *any* credit card form and make it the best part of the checkout process (without you changing anything). Everything is created with pure CSS, HTML, and Javascript — no images required.\n\n![card](http://i.imgur.com/qG3TenO.gif)\n\n## Usage (without jQuery)\n\nTo use, you'll need to include the Card JavaScript files into your HTML, no CSS link is necessary as the JavaScript file does this for you. You can find the necessary file at `/dist/card.js` and include it in your HTML like so.\n\n```html\n\u003c!-- at the end of BODY --\u003e\n\u003c!-- CSS is included via this JavaScript file --\u003e\n\u003cscript src=\"/path/to/card.js\"\u003e\u003c/script\u003e\n```\n\nOnce you've included those files, you can initialize Card.\n\n```javascript\nvar card = new Card({\n    // a selector or DOM element for the form where users will\n    // be entering their information\n    form: 'form', // *required*\n    // a selector or DOM element for the container\n    // where you want the card to appear\n    container: '.card-wrapper', // *required*\n\n    formSelectors: {\n        numberInput: 'input#number', // optional — default input[name=\"number\"]\n        expiryInput: 'input#expiry', // optional — default input[name=\"expiry\"]\n        cvcInput: 'input#cvc', // optional — default input[name=\"cvc\"]\n        nameInput: 'input#name' // optional - defaults input[name=\"name\"]\n    },\n\n    width: 200, // optional — default 350px\n    formatting: true, // optional - default true\n\n    // Strings for translation - optional\n    messages: {\n        validDate: 'valid\\ndate', // optional - default 'valid\\nthru'\n        monthYear: 'mm/yyyy', // optional - default 'month/year'\n    },\n\n    // Default placeholders for rendered fields - optional\n    placeholders: {\n        number: '•••• •••• •••• ••••',\n        name: 'Full Name',\n        expiry: '••/••',\n        cvc: '•••'\n    },\n\n    masks: {\n        cardNumber: '•' // optional - mask card number\n    },\n\n    // if true, will log helpful messages for setting up Card\n    debug: false // optional - default false\n});\n```\n### Installing card from bower\n\nIf you're using bower, you can install card.js with:\n\n    bower install card --save\n\n### Installing card from npm\n\nIf you're using npm, you can install card.js with:\n\n    npm install --save card\n\n\tvar $ = require(\"jquery\");\n    // The current card.js code does not explictly require jQuery, but instead uses the global, so this line is needed.\n    window.jQuery = $;\n    var card = require(\"card\");\n\n### Using multiple inputs for one field\n\nCard can be used in forms where you have multiple inputs that render to a single field (i.e. you have a first and last name input). To use Card with this functionality, just pass in a selector that selects the fields in the correct order. For example,\n\n```html\n\u003chtml\u003e\n\u003cbody\u003e\n\u003cdiv class='card-wrapper'\u003e\u003c/div\u003e\n\u003c!-- CSS is included via this JavaScript file --\u003e\n\u003cscript src=\"/path/to/card.js\"\u003e\u003c/script\u003e\n\u003cform id=\"cc-form\"\u003e\n    \u003cinput type=\"text\" name=\"number\"\u003e\n    \u003cinput type=\"text\" name=\"first-name\"/\u003e\n    \u003cinput type=\"text\" name=\"last-name\"/\u003e\n    \u003cinput type=\"text\" name=\"expiry\"/\u003e\n    \u003cinput type=\"text\" name=\"cvc\"/\u003e\n\u003c/form\u003e\n\u003cscript\u003e\nvar card = new Card({\n    form: 'cc-form',\n    container: '.card-wrapper',\n\n    formSelectors: {\n        nameInput: 'input[name=\"first-name\"], input[name=\"last-name\"]'\n    }\n});\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Rendering with different initial card placeholders\n\nCard renders with default placeholders for card `name`, `number`, `expiry`, and `cvc`. To override these placeholders, you can pass in a `placeholders` object.\n\n```html\n\u003chtml\u003e\n\u003cbody\u003e\n\u003cdiv class='card-wrapper'\u003e\u003c/div\u003e\n\u003c!-- CSS is included via this JavaScript file --\u003e\n\u003cscript src=\"/path/to/card.js\"\u003e\u003c/script\u003e\n\u003cform id=\"cc-form\"\u003e\n    \u003cinput type=\"text\" name=\"number\"\u003e\n    \u003cinput type=\"text\" name=\"name\"/\u003e\n    \u003cinput type=\"text\" name=\"expiry\"/\u003e\n    \u003cinput type=\"text\" name=\"cvc\"/\u003e\n\u003c/form\u003e\n\u003cscript\u003e\n\nvar card = new Card({\n    form: 'cc-form',\n    container: '.card-wrapper',\n\n    placeholders: {\n        number: '**** **** **** ****',\n        name: 'Arya Stark',\n        expiry: '**/****',\n        cvc: '***'\n    }\n});\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Translation\n\nTo render the card with the strings in a different language, you can pass in a `messages` object.\n\n```html\n\u003chtml\u003e\n\u003cbody\u003e\n\u003cdiv class='card-wrapper'\u003e\u003c/div\u003e\n\u003c!-- CSS is included via this JavaScript file --\u003e\n\u003cscript src=\"/path/to/card.js\"\u003e\u003c/script\u003e\n\u003cform id=\"cc-form\"\u003e\n    \u003cinput type=\"text\" name=\"number\"\u003e\n    \u003cinput type=\"text\" name=\"name\"/\u003e\n    \u003cinput type=\"text\" name=\"expiry\"/\u003e\n    \u003cinput type=\"text\" name=\"cvc\"/\u003e\n\u003c/form\u003e\n\u003cscript\u003e\n\nvar card = new Card({\n    form: 'cc-form',\n    container: '.card-wrapper',\n\n    messages: {\n        validDate: 'expire\\ndate',\n        monthYear: 'mm/yy'\n    }\n});\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Using with jQuery\n\nTo use with jQuery, you'll need to include the `jquery.card.js` file into your HTML. You can find the necessary file at `/dist/jquery.card.js` and include it in your HTML like so.\n\n```html\n\u003c!-- at the end of BODY --\u003e\n\u003c!-- CSS is included via this JavaScript file --\u003e\n\u003cscript src=\"/path/to/jquery.card.js\"\u003e\u003c/script\u003e\n```\n\nOnce you've included those files, you can initialize Card with jQuery.\n\n```javascript\n$('form').card({\n    // a selector or DOM element for the container\n    // where you want the card to appear\n    container: '.card-wrapper', // *required*\n\n    // all of the other options from above\n});\n\n```\n## Using with other javascript libraries\n\nCard has wrappers that make it easy to use with other javascript libraries:\n\n### Angular 1.x\n\n* [angular-card](https://github.com/gavruk/angular-card)\n\n### Angular 2+\n\n* [ngx-card](https://github.com/ihym/ngx-card)\n\n### Ember\n\n* [ember-credit-card](https://github.com/esbanarango/ember-credit-card)\n\n### React\n\n* [react-credit-card](https://github.com/JohnyDays/react-credit-card)\n* [card-react](https://github.com/shatran/card-react)\n* [react-plastic](https://github.com/armsteadj1/react-plastic) - static CSS only version.\n\n### Vue\n\nFor use with VueJs, install card.js from npm:\n\n```bash\nnpm install card --save\n\n```\nAdd in your component an Div with class 'card-wrapper', just pass in a selector that selects the fields in the correct order. Import the component card.js and add the object in instance mounted like this example:\n```html\n\u003cdiv class='card-wrapper'\u003e\u003c/div\u003e\n\n\u003cform\u003e\n    \u003cinput type=\"text\" name=\"number\"\u003e\n    \u003cinput type=\"text\" name=\"first-name\"/\u003e\n    \u003cinput type=\"text\" name=\"last-name\"/\u003e\n    \u003cinput type=\"text\" name=\"expiry\"/\u003e\n    \u003cinput type=\"text\" name=\"cvc\"/\u003e\n\u003c/form\u003e\n\n\u003cscript\u003e\nimport * as Card from \"card\";\n\nexport default {\n    name: \"Form CreditCard\",\n    mounted() {\n    new Card({ \n      form: \"form#cc-form\",\n      container: \".card-wrapper\",\n      formSelectors: { \n        numberInput: \"input#cc-number\",\n        expiryInput: \"input#cc-expiration\",\n        cvcInput: \"input#cc-cvv\",\n        nameInput: \"input#cc-name\"\n      },\n      width: 270,\n      formatting: true,\n      placeholders: {\n        number: \"•••• •••• •••• ••••\",\n        name: \"Nome Completo\",\n        expiry: \"••/••\",\n        cvc: \"•••\"\n      }\n    });\n  },\n}\n\u003c/script\u003e\n```\n\n\n\n\n## Development\n\nTo contribute, follow this steps:\n\n```bash\n$ git clone --recursive https://github.com/jessepollak/card.git\n$ cd card\n$ git submodule init \u0026\u0026 git submodule update\n$ npm install\n$ npm run development\n```\n\nNow, if you go to localhost:8080/example in your browser, you should see the demo page.\n\n## Places using Card\n\nCard is used in the wild in these places:\n\n* [InspectAll](http://www.inspectall.com/)\n* [PennyWhale](https://www.pennywhale.com/)\n* [MakeSpace](https://www.makespace.com/)\n* [Blumpa](http://www.blumpa.com/)\n* [CourseLoads](http://www.courseloads.com/)\n* [PubNub](http://pubnub.com/)\n* [GigSalad](https://www.gigsalad.com)\n* [Boligninja](http://www.boligninja.dk)\n* [EasyCarros](http://www.easycarros.com/)\n* [Sintelle](http://www.sintelleparapharmacie.com/)\n* [Wevorce](http://wevorce.com/)\n* [PayumServer](https://github.com/Payum/PayumServer)\n* [Paribus](https://paribus.co)\n* [Bizzabo](https://www.bizzabo.com)\n* [Tortuba](https://www.tortuba.com)\n* [Netlify](https://www.netlify.com)\n* [The Spice House](https://www.thespicehouse.com/)\n* [Touts](https://www.touts.com.br/)\n* [Ryman Limited](http://www.ryman.co.uk)\n* [Robert Dyas](http://www.robertdyas.co.uk)\n* [ROKA](https://www.rokahub.com)\n* [LeSalon](https://lesalon.com)\n* [Kenyan Directorate Of Immigration And Citizen Service](https://dis.ecitizen.go.ke)\n\nAre you using Card in production? If so, we'd love to link to you from this page. Open a PR or drop [@jessepollak](http://twitter.com/jessepollak) a line on [Twitter](http://twitter.com/jessepollak) and we'll add you right away!\n\n## Project scope\n\nThe project scope is to improve the capture of payment cards on websites. Issues and fixes related to the user interface and validating of payment cards are in scope.\n\nFor questions on how to use Card in your particular project, please ask on Stack Overflow or similar forum.\n\n## Donations\n\nIf you'd like to donate to help support development of Card, send Bitcoin directly to `17NUKd3v7GWben18kGhmFafa4ZpWrXpQSC` or through Coinbase [here](https://coinbase.com/jessepollak).\n","funding_links":[],"categories":["CSS","Credit card forms","SCSS","Form Widgets","前端开发框架及项目","css","Form Widgets [🔝](#readme)","UI","jquery","表单组件"],"sub_categories":["Other","其他_文本生成、文本对话","其它"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessepollak%2Fcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjessepollak%2Fcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessepollak%2Fcard/lists"}