{"id":16782157,"url":"https://github.com/marco-streng/styled-off-canvas","last_synced_at":"2025-07-18T02:33:53.819Z","repository":{"id":37271431,"uuid":"221882120","full_name":"marco-streng/styled-off-canvas","owner":"marco-streng","description":"A simple off canvas menu built with styled-components 💅","archived":false,"fork":false,"pushed_at":"2024-11-20T09:38:26.000Z","size":6571,"stargazers_count":77,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T00:30:04.149Z","etag":null,"topics":["mobile","navigation","off-canvas","react","styled-components"],"latest_commit_sha":null,"homepage":"styled-off-canvas.vercel.app","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/marco-streng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2019-11-15T08:45:47.000Z","updated_at":"2024-12-18T00:58:25.000Z","dependencies_parsed_at":"2024-01-09T18:27:07.452Z","dependency_job_id":"9cee4aad-3c92-48b6-8d88-721c15662957","html_url":"https://github.com/marco-streng/styled-off-canvas","commit_stats":{"total_commits":800,"total_committers":4,"mean_commits":200.0,"dds":0.51875,"last_synced_commit":"56135638da9243c46b0174d75d6200d6a1e2ca46"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/marco-streng/styled-off-canvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-streng%2Fstyled-off-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-streng%2Fstyled-off-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-streng%2Fstyled-off-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-streng%2Fstyled-off-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marco-streng","download_url":"https://codeload.github.com/marco-streng/styled-off-canvas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-streng%2Fstyled-off-canvas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265692332,"owners_count":23812195,"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":["mobile","navigation","off-canvas","react","styled-components"],"created_at":"2024-10-13T07:44:34.992Z","updated_at":"2025-07-18T02:33:53.769Z","avatar_url":"https://github.com/marco-streng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/marco-streng/styled-off-canvas/master/logo.png\" width=\"220\" alt=\"styled-off-canvas\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n   💅 styled-off-canvas\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  A simple off canvas menu built with \u003ca href=\"https://www.styled-components.com/\" target=\"_blank\"\u003estyled-components\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/marco-streng/styled-off-canvas/actions\"\u003e\n    \u003cimg alt=\"Node CI build status\" src=\"https://github.com/marco-streng/styled-off-canvas/workflows/Node%20CI/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.styled-components.com/\"\u003e\n    \u003cimg alt=\"Built with Styled Components\" src=\"https://img.shields.io/badge/built%20with-styled%20components-db7093.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Description\n\nstyled-off-canvas is a customizable off-canvas menu built with [React](https://reactjs.org/) and [styled-components](https://www.styled-components.com/)\n\n## Demo\n\nA demo can be found here: \u003ca href=\"https://styled-off-canvas.vercel.app/\"\u003eDemo\u003c/a\u003e\n\n## Installation\n\n```\n# via npm\nnpm install styled-off-canvas\n\n# via yarn\nyarn install styled-off-canvas\n```\n\n## Implementation\n\n### Hook\n\nThe `useOffCanvas()` hook provies the current state and all methods to contorl the menu.\n\n```javascript\nconst { isOpen, toggle, close, open } = useOffCanvas();\n``````\n\n### Components\n\n`styled-off-canvas` comes with three components: `\u003cOffCanvasProvider /\u003e`, `\u003cMenu /\u003e` and `\u003cOverlay /\u003e`.\n\n`\u003cOffCanvasProvider /\u003e` is a wrapping component which provides the menus context.\n\n`\u003cMenu /\u003e` is the off-canvas menu itself. You can pass anything you want as children (e.g. styled list of router links)\n\n`\u003cOverlay /\u003e` is an optional component which renders a semi-transparent layer above your app content.\n\n### Example\n\n```javascript\nimport React, { useState } from 'react'\nimport { StyledOffCanvas, Menu, Overlay } from 'styled-off-canvas'\n\nconst Navigation = () =\u003e {\n  const { close } = useOffCanvas();\n\n  return (\n    \u003cMenu closeOnEsc\u003e\n      \u003cCrossIcon onClick={() =\u003e close()} /\u003e\n      \u003cList /\u003e\n    \u003c/Menu\u003e\n  );\n};\n\nconst Burger = () =\u003e {\n  const { isOpen, toggle } = useOffCanvas();\n\n  return (\n    \u003cBurgerIcon onClick={() =\u003e toggle()} /\u003e\n  );\n};\n\nconst App = () =\u003e {\n  return (\n    \u003cContainer\u003e\n      \u003cBurger /\u003e\n      \u003cNavigation /\u003e\n\n      \u003cdiv\u003ethis is some nice content!\u003c/div\u003e\n\n      \u003cOverlay /\u003e\n    \u003c/Container\u003e\n  );\n};\n\nexport default App\n```\n\n### Properties\n\n`\u003cMenu /\u003e` component\n\n* `background = '#fff'`: background color of the menu\n* `duration = '500ms'`: duration of the css transition of the menu\n* `closeOnEsc = true`: if the menu should close on esc keydown\n* `position = 'right'`: position of the menu (`left` or `right`)\n* `width = '300px'`: maximum width of the menu\n* `onClose`: callback function if menu closes (e.g. by click on the overlay)\n\n`\u003cOverlay /\u003e` component\n\n* `background = '#000'`: background color of the overlay\n* `duration = '500ms'`: duration of the open/close animation of the overlay\n* `opacity = 0.3`: css opacity of the overlay\n\nAlso `\u003cMenu /\u003e` and `\u003cOverlay /\u003e` can additionally be customized with styled-components\n\n```jsx\n// example\n\n\u003cMenu css={{ border: `1px solid ${theme.menu.borderColor}` }}\u003e...\u003c/Menu\u003e\n```\n\n## License\n\nCopyright (c) 2024-present Marco Streng. See [LICENSE](./LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-streng%2Fstyled-off-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarco-streng%2Fstyled-off-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-streng%2Fstyled-off-canvas/lists"}