{"id":17624733,"url":"https://github.com/neosiae/react-aria-offcanvas","last_synced_at":"2025-04-16T04:59:52.213Z","repository":{"id":32596801,"uuid":"132559836","full_name":"neosiae/react-aria-offcanvas","owner":"neosiae","description":"Accessible Off-Canvas component for React.js","archived":false,"fork":false,"pushed_at":"2023-09-26T21:59:20.000Z","size":3308,"stargazers_count":23,"open_issues_count":18,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T05:01:59.932Z","etag":null,"topics":["accessibility","javascript","offcanvas","reactjs"],"latest_commit_sha":null,"homepage":"https://neosiae.github.io/react-aria-offcanvas/","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/neosiae.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-05-08T05:45:33.000Z","updated_at":"2023-06-18T10:59:40.000Z","dependencies_parsed_at":"2024-06-18T22:57:06.192Z","dependency_job_id":"717fdf07-653a-4ab0-a36a-a1d829fcef40","html_url":"https://github.com/neosiae/react-aria-offcanvas","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Freact-aria-offcanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Freact-aria-offcanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Freact-aria-offcanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Freact-aria-offcanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neosiae","download_url":"https://codeload.github.com/neosiae/react-aria-offcanvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249199635,"owners_count":21228992,"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":["accessibility","javascript","offcanvas","reactjs"],"created_at":"2024-10-22T22:05:14.475Z","updated_at":"2025-04-16T04:59:52.194Z","avatar_url":"https://github.com/neosiae.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-aria-offcanvas\n\n![npm](https://img.shields.io/npm/v/react-aria-offcanvas.svg?style=flat-square) ![Travis (.org) branch](https://img.shields.io/travis/neosiae/react-aria-offcanvas/master?style=flat-square) ![npm](https://img.shields.io/npm/dw/react-aria-offcanvas.svg?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/react-aria-offcanvas.svg?style=flat-square) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nAccessible Off-Canvas component for React.js\n\n## Demo\n\nhttps://neosiae.github.io/react-aria-offcanvas/\n\n## Installation\n\nInstall `react-aria-offcanvas` using npm:\n\n\u003e npm install --save react-aria-offcanvas\n\nOr via yarn:\n\n\u003e yarn add react-aria-offcanvas\n\n## Usage\n\n```javascript\nimport React, { Component, Fragment } from 'react'\nimport OffCanvas from 'react-aria-offcanvas'\n\nconst Navigation = () =\u003e (\n  \u003cnav id=\"menu\"\u003e\n    \u003cul\u003e\n      \u003cli\u003e\n        \u003ca href=\"#m-i-1\"\u003eMenu Item 1\u003c/a\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#m-i-2\"\u003eMenu Item 2\u003c/a\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#m-i-3\"\u003eMenu Item 3\u003c/a\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#m-i-4\"\u003eMenu Item 4\u003c/a\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#m-i-5\"\u003eMenu Item 5\u003c/a\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/nav\u003e\n)\n\nexport default class App extends Component {\n  state = {\n    isOpen: false,\n  }\n\n  open = () =\u003e {\n    this.setState({ isOpen: true })\n  }\n\n  close = () =\u003e {\n    this.setState({ isOpen: false })\n  }\n\n  render() {\n    return (\n      \u003cFragment\u003e\n        \u003cbutton\n          id=\"menu-button\"\n          aria-label=\"Menu\"\n          aria-controls=\"menu\"\n          aria-expanded={this.state.isOpen}\n          onClick={this.open}\n        \u003e\n          Click here\n        \u003c/button\u003e\n        \u003cOffCanvas\n          isOpen={this.state.isOpen}\n          onClose={this.close}\n          labelledby=\"menu-button\"\n        \u003e\n          \u003cbutton onClick={this.close}\u003eClose\u003c/button\u003e\n          \u003cNavigation /\u003e\n        \u003c/OffCanvas\u003e\n      \u003c/Fragment\u003e\n    )\n  }\n}\n```\n\n## Props\n\nThe only required property for the component is `isOpen`, which controls whether the component is displayed or not.\n\n| Prop                       | Type     | Default                        | Description                                                                                                                        |\n| -------------------------- | -------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |\n| `isOpen`                   | `bool`   | `false`                        | Open or close OffCanvas.                                                                                                           |\n| `width`                    | `string` | `300px`                        | The width of OffCanvas.                                                                                                            |\n| `height`                   | `string` | `300px`                        | The height of OffCanvas.                                                                                                           |\n| `position`                 | `string` | `left`                         | Position OffCanvas to the `left`, `right`, `top` or `bottom`.                                                                      |\n| `mainContainerSelector`    | `string` |                                | Allow `OffCanvas` to push your page. Pass a valid CSS selector of an element that should be pushed.                                |\n| `onClose`                  | `func`   |                                | Callback fired when the overlay is clicked or esc key is pressed.                                                                  |\n| `closeOnEsc`               | `bool`   | `true`                         | Close OffCanvas on esc key.                                                                                                        |\n| `closeOnOverlayClick`      | `bool`   | `true`                         | Close OffCanvas on overlay click.                                                                                                  |\n| `lockBodyAfterOpen`        | `bool`   | `true`                         | Lock body overflow on menu open                                                                                               |\n| `trapFocusAfterOpen`       | `bool`   | `true`                         | Trap focus when OffCanvas is open.                                                                                                 |\n| `returnFocusAfterClose`    | `bool`   | `true`                         | Return focus to the element that had focus before opening OffCanvas.                                                               |\n| `focusFirstChildAfterOpen` | `bool`   |                                | Set initial focus on the first focusable child inside OffCanvas.                                                                   |\n| `focusThisChildAfterOpen`  | `string` |                                | Set initial focus on a specific child inside OffCanvas. Pass a valid CSS selector of an element that should receive initial focus. |\n| `style`                    | `object` | `{ overlay: {}, content: {} }` | Inline styles object. It has two keys: `overlay` - overlay styles and `content` - OffCanvas styles.                                |\n| `className`                | `string` |                                | Custom className for OffCanvas.                                                                                                    |\n| `overlayClassName`         | `string` |                                | Custom className for the overlay.                                                                                                  |\n| `role`                     | `string` |                                | Custom role for OffCanvas.                                                                                                         |\n| `label`                    | `string` |                                | Custom aria-label for OffCanvas.                                                                                                   |\n| `labelledby`               | `string` |                                | Custom aria-labelledby for OffCanvas.                                                                                              |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosiae%2Freact-aria-offcanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneosiae%2Freact-aria-offcanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosiae%2Freact-aria-offcanvas/lists"}