{"id":13421891,"url":"https://github.com/vutran/react-offcanvas","last_synced_at":"2025-04-13T15:40:39.992Z","repository":{"id":50652878,"uuid":"53351562","full_name":"vutran/react-offcanvas","owner":"vutran","description":":art: Off-canvas menus for React.","archived":false,"fork":false,"pushed_at":"2020-04-22T15:41:27.000Z","size":1252,"stargazers_count":49,"open_issues_count":5,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T05:43:32.861Z","etag":null,"topics":["javascript","react","react-component","sidebar"],"latest_commit_sha":null,"homepage":"http://vutran.github.io/react-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/vutran.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":"2016-03-07T19:12:48.000Z","updated_at":"2024-03-14T04:28:37.000Z","dependencies_parsed_at":"2022-09-19T07:12:59.196Z","dependency_job_id":null,"html_url":"https://github.com/vutran/react-offcanvas","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vutran%2Freact-offcanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vutran%2Freact-offcanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vutran%2Freact-offcanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vutran%2Freact-offcanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vutran","download_url":"https://codeload.github.com/vutran/react-offcanvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248739808,"owners_count":21154240,"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":["javascript","react","react-component","sidebar"],"created_at":"2024-07-30T23:00:33.505Z","updated_at":"2025-04-13T15:40:39.969Z","avatar_url":"https://github.com/vutran.png","language":"JavaScript","funding_links":[],"categories":["UI Components","Uncategorized","Demos","\u003csummary\u003eUI Components\u003c/summary\u003e"],"sub_categories":["Menu","Uncategorized"],"readme":"# React Off-Canvas\n\nOff-canvas menus for React.\n\n## Installation\n\n```bash\n$ npm install --save react-offcanvas\n```\n\n## Usage\n\n### Basic Usage\n\n```jsx\n\u003cOffCanvas\n  width={300}\n  transitionDuration={300}\n  isMenuOpened={false}\n  position={\"left\"}\n  effect={\"overlay\"}\n\u003e\n  \u003cOffCanvasBody className={\"my-body-class\"} style={{ fontSize: \"18px\" }}\u003e\n    This is the canvas body.\n  \u003c/OffCanvasBody\u003e\n  \u003cOffCanvasMenu className={\"my-menu-class\"} style={{ fontWeight: \"bold\" }}\u003e\n    This is the canvas menu.\n  \u003c/OffCanvasMenu\u003e\n\u003c/OffCanvas\u003e\n```\n\n### Within An Application\n\nYou'll need to hook up your application to handle the state for toggling the menu. Check out the basic example below:\n\n```js\n\"use strict\";\n\nimport React, { Component } from \"react\";\nimport { OffCanvas, OffCanvasMenu, OffCanvasBody } from \"react-offcanvas\";\n\nexport default class App extends Component {\n  componentWillMount() {\n    // sets the initial state\n    this.setState({\n      isMenuOpened: false\n    });\n  }\n\n  render() {\n    return (\n      \u003cOffCanvas\n        width={300}\n        transitionDuration={300}\n        effect={\"parallax\"}\n        isMenuOpened={this.state.isMenuOpened}\n        position={\"right\"}\n      \u003e\n        \u003cOffCanvasBody\n          className={styles.bodyClass}\n          style={{ fontSize: \"30px\" }}\n        \u003e\n          \u003cp\u003eThis is the main body container.\u003c/p\u003e\n          \u003cp\u003e\n            \u003ca href=\"#\" onClick={this.handleClick.bind(this)}\u003e\n              Click here\n            \u003c/a\u003e{\" \"}\n            to toggle the menu.\n          \u003c/p\u003e\n        \u003c/OffCanvasBody\u003e\n        \u003cOffCanvasMenu className={styles.menuClass}\u003e\n          \u003cp\u003ePlaceholder content.\u003c/p\u003e\n          \u003cul\u003e\n            \u003cli\u003eLink 1\u003c/li\u003e\n            \u003cli\u003eLink 2\u003c/li\u003e\n            \u003cli\u003eLink 3\u003c/li\u003e\n            \u003cli\u003eLink 4\u003c/li\u003e\n            \u003cli\u003eLink 5\u003c/li\u003e\n            \u003cli\u003e\n              \u003ca href=\"#\" onClick={this.handleClick.bind(this)}\u003e\n                Toggle Menu\n              \u003c/a\u003e\n            \u003c/li\u003e\n          \u003c/ul\u003e\n        \u003c/OffCanvasMenu\u003e\n      \u003c/OffCanvas\u003e\n    );\n  }\n\n  handleClick() {\n    // toggles the menu opened state\n    this.setState({ isMenuOpened: !this.state.isMenuOpened });\n  }\n}\n```\n\n## Components\n\n### `OffCanvas`\n\nThis is the main component you will be using to compose your body and menu.\n\n| Prop                 | Type     | Default | Description                                          |\n| :------------------- | :------- | :------ | :--------------------------------------------------- |\n| `width`              | `number` | 250     | The width of the menu and off-canvas transition.     |\n| `transitionDuration` | `number` | 250     | The time in ms for the transition.                   |\n| `isMenuOpened`       | `bool`   | false   | Is the menu opened or not.                           |\n| `position`           | `string` | \"left\"  | Position the menu to the \"left\" or \"right\".          |\n| `effect`             | `string` | \"push\"  | Choose menu effect. \"push\", \"overlay\" or \"parallax\". |\n\n### `OffCanvasBody`\n\n| Prop                 | Type     | Default | Description                                      |\n| :------------------- | :------- | :------ | :----------------------------------------------- |\n| `width`              | `number` | 250     | The width of the menu and off-canvas transition. |\n| `transitionDuration` | `number` | 250     | The time in ms for the transition.               |\n| `isMenuOpened`       | `bool`   | false   | Is the menu opened or not.                       |\n| `position`           | `string` | \"left\"  | Position the menu to the \"left\" or \"right\".      |\n| `className`          | `string` |         | Custom className for the element.                |\n| `style`              | `object` |         | CSS style object for the element.                |\n\n### `OffCanvasMenu`\n\n| Prop                 | Type     | Default | Description                                      |\n| :------------------- | :------- | :------ | :----------------------------------------------- |\n| `width`              | `number` | 250     | The width of the menu and off-canvas transition. |\n| `transitionDuration` | `number` | 250     | The time in ms for the transition.               |\n| `isMenuOpened`       | `bool`   | false   | Is the menu opened or not.                       |\n| `position`           | `string` | \"left\"  | Position the menu to the \"left\" or \"right\".      |\n| `className`          | `string` |         | Custom className for the element.                |\n| `style`              | `object` |         | CSS style object for the element.                |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvutran%2Freact-offcanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvutran%2Freact-offcanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvutran%2Freact-offcanvas/lists"}