{"id":25177484,"url":"https://github.com/cuadros-code/react-code","last_synced_at":"2025-04-04T02:40:33.966Z","repository":{"id":43767180,"uuid":"511575550","full_name":"cuadros-code/react-code","owner":"cuadros-code","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-07T17:11:35.000Z","size":2313,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T18:46:18.493Z","etag":null,"topics":["package","react","typescript"],"latest_commit_sha":null,"homepage":"https://cuadros-code.github.io/react-code/","language":"TypeScript","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/cuadros-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-07T15:12:26.000Z","updated_at":"2022-07-07T17:00:37.000Z","dependencies_parsed_at":"2022-09-26T21:11:38.726Z","dependency_job_id":null,"html_url":"https://github.com/cuadros-code/react-code","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuadros-code%2Freact-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuadros-code%2Freact-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuadros-code%2Freact-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuadros-code%2Freact-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuadros-code","download_url":"https://codeload.github.com/cuadros-code/react-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247112739,"owners_count":20885605,"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":["package","react","typescript"],"created_at":"2025-02-09T14:25:29.324Z","updated_at":"2025-04-04T02:40:33.945Z","avatar_url":"https://github.com/cuadros-code.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Pin Code\n\n\u003e Pin input component for React\n\n## Installation\n\nTo get started, install and save in your `package.json` dependencies, run:\n\n```bash\nnpm i @kevincuadros/react-code\n```\nor\n```bash\nyarn add @kevincuadros/react-code\n```\n\n## Demo\n\n![image](https://github.com/cuadros-code/react-code/blob/gh-pages/default.png?raw=true)\n\n[Documentation and examples](https://cuadros-code.github.io/react-code/?path=/story/pin-code--default)\n\n[Source code](https://github.com/cuadros-code/react-code)\n\n## Importing\n\nYou can use the following two ways to import module.\n\n```javascript\nimport { PinCode } from '@kevincuadros/react-code'\n```\n\n## Usage\n### Basic Example\n```jsx\nimport { PinCode } from '@kevincuadros/react-code';\n\nconst App = () =\u003e {\n  \n  const [value, setValue] = React.useState('');\n\n  return (\n    \u003cPinCode\n      length={4}\n      onChange={setValue}\n    /\u003e\n  );\n};\n```\n\n## PinCode input length\n`PinCode` expects a number for the `length` prop. The number of input fields rendered is equal to the length of the array.\n\n## Disable focus management\nBy default, `PinCode` moves focus automatically to the next input once a field is filled. It also transfers focus to a previous input when `Backspace` is pressed with focus on an empty input.\n\n## AutoFocus\n`PinCode` offers a way let it focus from the start. Simply set `autoFocus` prop to **true** to focus the first input upon initial mounting of the component.\n\n## Changing the placeholder\nBy default, `PinCode` placeholder is (''), you can change that if you want.\n\n## Compare value\nBy default `valueToValidate` is (''), when all the fields are completed the value will be validated\n\n\n## API\n\n**`PinCode` Props**\n\n| Name(*required) | Type | Default | Description |\n| :-------------- | :--- | :------ | :---------- |\n| length(*) | number |  | Number of rendered elements. |\n| autoFocus | boolean | false | If true the input will be focused on the first mount. |\n| valueToValidate  | string | \"\" | Value to compare |\n| invalidBorderColor | string | rgb(220,53,69) | Let you customize border color when the input is invalid.\n| validBorderColor | string | rgb(220,53,69) | Let you customize border color when the input is valid.\n| onChange | Dispatch\u003cReact.SetStateAction\u003cstring\u003e\u003e |  | Called when input value is changed. |\n| placeholder | string | \"\" | Displayed when the pin code is not entered yet. |\n| inputStyle | object | {} | Lets you customize input element. |\n\n## License\n\nMIT\n\n\n[![storybook](https://raw.githubusercontent.com/storybooks/brand/master/badge/badge-storybook.svg)](https://luffy84217.github.io/react-input-pin-code/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuadros-code%2Freact-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuadros-code%2Freact-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuadros-code%2Freact-code/lists"}