{"id":13406210,"url":"https://github.com/samuelmeuli/react-magnifier","last_synced_at":"2025-04-04T22:04:27.635Z","repository":{"id":32689982,"uuid":"120022217","full_name":"samuelmeuli/react-magnifier","owner":"samuelmeuli","description":"🔍 React image zoom component","archived":false,"fork":false,"pushed_at":"2024-02-15T11:29:24.000Z","size":19030,"stargazers_count":153,"open_issues_count":10,"forks_count":42,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T21:02:07.502Z","etag":null,"topics":["component","image","image-zoom","magnifier","magnifying-glass","react","react-component","zoom"],"latest_commit_sha":null,"homepage":"https://react-magnifier.samuelmeuli.com/","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/samuelmeuli.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-02T19:28:12.000Z","updated_at":"2025-02-09T09:04:51.000Z","dependencies_parsed_at":"2024-06-18T14:16:28.160Z","dependency_job_id":null,"html_url":"https://github.com/samuelmeuli/react-magnifier","commit_stats":{"total_commits":113,"total_committers":5,"mean_commits":22.6,"dds":0.3097345132743363,"last_synced_commit":"863f8c7c6228aeae9e022efe0b4cc492c8494115"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelmeuli%2Freact-magnifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelmeuli%2Freact-magnifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelmeuli%2Freact-magnifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelmeuli%2Freact-magnifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelmeuli","download_url":"https://codeload.github.com/samuelmeuli/react-magnifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"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":["component","image","image-zoom","magnifier","magnifying-glass","react","react-component","zoom"],"created_at":"2024-07-30T19:02:24.202Z","updated_at":"2025-04-04T22:04:27.608Z","avatar_url":"https://github.com/samuelmeuli.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# react-magnifier\n\n**React image zoom component**\n\n- Simple and customizable\n- Supports touch screens\n- Allows different files for large image and magnifying glass (e.g. thumbnail and high-resolution image)\n\n→ **[Demo](https://react-magnifier.samuelmeuli.com)**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/demo.gif\" width=600 alt=\"Demo\"\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall the package using NPM:\n\n```\nnpm install react-magnifier\n```\n\nAdd the component to your React application:\n\n```jsx\nimport Magnifier from \"react-magnifier\";\nimport yourImage from \"./path/to/image\";\n\nexport default function ExampleComponent() {\n  return \u003cMagnifier src={yourImage} width={500} /\u003e;\n}\n```\n\n## Configuration\n\n| Prop             | Type          | Default    | Description                                                                                                                                                      |\n| ---------------- | ------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `src` (required) | String        | –          | URL/path of the large image                                                                                                                                      |\n| `height`         | Number/String | `'auto'`   | Image height (absolute or relative values possible)                                                                                                              |\n| `width`          | Number/String | `'100%'`   | Image width (absolute or relative values possible)                                                                                                               |\n| `className`      | String        | `''`       | Class which will be applied to the image wrapper                                                                                                                 |\n| `zoomImgSrc`     | String        | –          | URL/path of the image inside the magnifying glass (if not specified, the large image will be used)                                                               |\n| `zoomFactor`     | Number        | `1.5`      | Factor by which the zoom image will be scaled (based on the size of the large image)                                                                             |\n| `mgWidth`        | Number        | `150`      | Width of the magnifying glass in px                                                                                                                              |\n| `mgHeight`       | Number        | `150`      | Height of the magnifying glass in px                                                                                                                             |\n| `mgBorderWidth`  | Number        | `2`        | Border width of the magnifying glass in px                                                                                                                       |\n| `mgShape`        | String        | `'circle'` | Shape of the magnifying glass (possible values: `'circle'`, `'square'`)                                                                                          |\n| `mgShowOverflow` | Boolean       | `true`     | Set this to `false` to cut off the magnifying glass at the image borders. When disabling `mgShowOverflow`, it's recommended that you also set all offsets to `0` |\n| `mgMouseOffsetX` | Number        | `0`        | Horizontal offset of the magnifying glass in px when hovering with a mouse                                                                                       |\n| `mgMouseOffsetY` | Number        | `0`        | Vertical offset of the magnifying glass in px when hovering with a mouse                                                                                         |\n| `mgTouchOffsetX` | Number        | `-50`      | Horizontal offset of the magnifying glass in px when dragging on a touch screen                                                                                  |\n| `mgTouchOffsetY` | Number        | `-50`      | Vertical offset of the magnifying glass in px when dragging on a touch screen                                                                                    |\n\nAny other props will be passed down to the `\u003cimg\u003e` element. This way, you can e.g. add an `alt` attribute to the image.\n\n## Custom styling\n\n```css\n.magnifier {\n  /* Styles for \u003cdiv\u003e around image and magnifying glass */\n}\n\n.magnifier-image {\n  /* Styles for large image */\n}\n\n.magnifying-glass {\n  /* Styles for magnifying glass */\n}\n```\n\n## Development\n\nRequirements: Node.js, Yarn\n\n1. Clone this repository: `git clone [repo-url]`\n2. Install all dependencies: `yarn install`\n3. Run `yarn start` to generate the library bundle using [Rollup](https://github.com/rollup/rollup) and see the component in action using [Storybook](https://github.com/storybooks/storybook)\n\nSuggestions and contributions are always welcome! Please first discuss changes via issue before submitting a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelmeuli%2Freact-magnifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelmeuli%2Freact-magnifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelmeuli%2Freact-magnifier/lists"}