{"id":28444206,"url":"https://github.com/bence-toth/react-hook-device-orientation","last_synced_at":"2026-05-01T02:32:44.541Z","repository":{"id":34205993,"uuid":"171560163","full_name":"bence-toth/react-hook-device-orientation","owner":"bence-toth","description":"A React hook for detecting device orientation","archived":false,"fork":false,"pushed_at":"2023-03-04T03:09:56.000Z","size":214,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T09:08:14.722Z","etag":null,"topics":["device-orientation","react","react-hooks"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bence-toth.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":"2019-02-19T22:28:58.000Z","updated_at":"2022-12-22T15:32:20.000Z","dependencies_parsed_at":"2023-01-15T05:16:59.523Z","dependency_job_id":null,"html_url":"https://github.com/bence-toth/react-hook-device-orientation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bence-toth/react-hook-device-orientation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bence-toth%2Freact-hook-device-orientation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bence-toth%2Freact-hook-device-orientation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bence-toth%2Freact-hook-device-orientation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bence-toth%2Freact-hook-device-orientation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bence-toth","download_url":"https://codeload.github.com/bence-toth/react-hook-device-orientation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bence-toth%2Freact-hook-device-orientation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262637224,"owners_count":23341114,"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":["device-orientation","react","react-hooks"],"created_at":"2025-06-06T09:08:09.297Z","updated_at":"2026-05-01T02:32:39.496Z","avatar_url":"https://github.com/bence-toth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-hook-device-orientation :dizzy:\n\nA React hook for detecting [device orientation](https://developer.mozilla.org/en-US/docs/Web/API/Detecting_device_orientation).\n\n## Installation\n\nUsing `npm`:\n\n```sh\nnpm install --save react-hook-device-orientation\n```\n\nUsing `yarn`:\n\n```sh\nyarn add react-hook-device-orientation\n```\n\n## Usage\n\n```jsx\nimport React from 'react'\nimport useDeviceOrientation from 'react-hook-device-orientation'\n\nconst ComponentWithDeviceOrientation = () =\u003e {\n  const deviceOrientation = useDeviceOrientation()\n\n  return (\n    \u003cul\u003e\n      \u003cli\u003eAlpha:    {orientation.alpha}\u003c/li\u003e\n      \u003cli\u003eBeta:     {orientation.beta}\u003c/li\u003e\n      \u003cli\u003eGamma:    {orientation.gamma}\u003c/li\u003e\n      \u003cli\u003eAbsolute: {orientation.absolute ? 'yes' : 'no'}\u003c/li\u003e\n    \u003c/ul\u003e\n  )\n}\n```\n\n## Caveats\n\nThere are slightly different implementations of the web API responsible for accessing device orientation, and therefore the values you get from this hook might not be consistent across different browsers. [Read more](https://caniuse.com/#feat=deviceorientation) about this.\n\n## Contributions\n\nContributions are welcome. File bug reports, create pull requests, feel free to reach out at tothab@gmail.com.\n\n## Licence\n\nLGPL-3.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbence-toth%2Freact-hook-device-orientation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbence-toth%2Freact-hook-device-orientation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbence-toth%2Freact-hook-device-orientation/lists"}