{"id":2130700,"url":"https://github.com/rexxars/react-chess","last_synced_at":"2025-03-16T10:31:54.182Z","repository":{"id":26961132,"uuid":"112026160","full_name":"rexxars/react-chess","owner":"rexxars","description":"Renders a chess board using React","archived":false,"fork":false,"pushed_at":"2022-12-07T17:20:22.000Z","size":624,"stargazers_count":84,"open_issues_count":24,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-09T10:01:45.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rexxars.github.io/react-chess/","language":"JavaScript","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/rexxars.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":"2017-11-25T18:38:07.000Z","updated_at":"2024-12-23T02:37:53.000Z","dependencies_parsed_at":"2023-01-14T08:30:35.461Z","dependency_job_id":null,"html_url":"https://github.com/rexxars/react-chess","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexxars%2Freact-chess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexxars%2Freact-chess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexxars%2Freact-chess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexxars%2Freact-chess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rexxars","download_url":"https://codeload.github.com/rexxars/react-chess/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814896,"owners_count":20352036,"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":[],"created_at":"2024-01-21T23:25:36.246Z","updated_at":"2025-03-16T10:31:53.839Z","avatar_url":"https://github.com/rexxars.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cimg align=\"right\" width=\"270\" height=\"270\" src=\"assets/react-chess.png\" alt=\"react-chess\"\u003e\n\n# react-chess\n\n[![npm version](http://img.shields.io/npm/v/react-chess.svg?style=flat-square)](http://browsenpm.org/package/react-chess)[![Build Status](http://img.shields.io/travis/rexxars/react-chess/master.svg?style=flat-square)](https://travis-ci.org/rexxars/react-chess)\n\nRenders a chess board using React\n\n## Installation\n\n```\nnpm install --save react-chess\n```\n\n## Demo\n\n* [Basic but functional demo](https://rexxars.github.io/react-chess/)\n\n## Usage\n\n### Default lineup, movable pieces\n\n```js\nconst React = require('react')\nconst ReactDOM = require('react-dom')\nconst Chess = require('react-chess')\n\nReactDOM.render(\u003cChess /\u003e, document.getElementById('main'))\n```\n\n### Specifying lineups\n\n```js\nconst React = require('react')\nconst ReactDOM = require('react-dom')\nconst Chess = require('react-chess')\n\nconst lineup = ['R@h1', 'P@f2', 'q@d8', 'R@a1', 'P@a2', 'P@c2', 'b@c8', 'p@d7', 'Q@d1', 'n@g8']\n\nReactDOM.render(\u003cChess pieces={lineup} /\u003e, document.getElementById('main'))\n```\n\n## Properties\n\n* `allowMoves` - _boolean_ Whether or not to allow piece movement (default: `true`)\n* `highlightTarget` - _boolean_ Whether or not to highlight the target square on move (default:\n  `true`)\n* `drawLabels` - _boolean_ Whether or not to render labels (1-8, a-h) (default: `true`)\n* `lightSquareColor` - _string_ Color to use for light squares (default: `#f0d9b5`)\n* `darkSquareColor` - _string_ Color to use for dark squares (default: `#b58863`)\n* `pieces` - _array_ Array of pieces to draw. Each item should be a piece in algebraic notation, for\n  instance `Q@d1` for a white queen at square `d1`. (default: `Chess.getDefaultLineup()`)\n* `onMovePiece` - _function_ Function that is called when a piece moves to a new position. Receives\n  three arguments:\n  * `piece` - _object_ Object with properties `notation` (`R@h1` etc), `name` (`R`), `position`\n    (`h1`), `index` (index in `pieces` array)\n  * `fromSquare` - _string_ Previous square position\n  * `toSquare` - _string_ New square position\n* `onDragStart` - _function_ Function that is called when a piece starts to move. Receives same\n  arguments as `onMovePiece` except `toSquare`. Returning `false` from this function will prevent\n  the dragging from happening.\n\n## License\n\nMIT © [Espen Hovlandsdal](https://espen.codes/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexxars%2Freact-chess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frexxars%2Freact-chess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexxars%2Freact-chess/lists"}