Framework:
  • JavaScript / Vanilla JS
  • React.js
  • Vue.js
On this page

Angular Offcanvas Component

Angular Offcanvas component allows to build hidden sidebars into your project for navigation, shopping carts, etc.

## Examples ### Live demo Use the buttons below to show and hide an offcanvas component.
Loading...
Loading...
Loading...
### Placement There's no default placement for offcanvas components, so you must add one of the modifier props below; - `placement="start"` places offcanvas on the left of the viewport (shown above) - `placement="end"` places offcanvas on the right of the viewport - `placement="top"` places offcanvas on the top of the viewport - `placement="bottom"` places offcanvas on the bottom of the viewport
Loading...
Loading...
Loading...
### Backdrop and Scroll Scrolling the `body` element is disabled when an offcanvas and its backdrop are visible. Use the `scroll` property to toggle body scrolling and `backdrop` to toggle the backdrop.
Loading...
Loading...
Loading...
### Static Backdrop With `backdrop` prop set to `static`, the offcanvas will not close when clicking outside of it nor pressing `Esc`.
Loading...
Loading...
Loading...
### Responsive Responsive offcanvas hides the content outside the viewport below the specified breakpoint. Above that breakpoint, the content is displayed as usual.
Loading...
Loading...
Loading...
### Dark offcanvas With `.text-bg-dark` utility class you can change the appearance of your offcanvas component.
Loading...
Loading...
Loading...
## Accessibility Since the offcanvas panel is conceptually a modal dialog, be sure to add `aria-labelledby="..."` —referencing the offcanvas title— to `c-offcanvas`>. Note that you don’t need to add `role="dialog"` since we already add it automatically. --- ## API reference ### Offcanvas Module
```typescript import { OffcanvasModule } from '@coreui/angular'; @NgModule({ imports: [OffcanvasModule,] }) export class AppModule() { } ```
### c-offcanvas _component_ ##### Inputs
| name | description | type | default | version | | ---- | ----------- | ---- | ------- | ------- | | `backdrop` | Apply a backdrop on body while offcanvas is visible. | `boolean \| 'static'` | _true_ | `static` 4.3.10+ | `keyboard` | Closes the offcanvas when escape key is pressed. | `boolean` |_true_| | `id` | Html id attr, required for programmatic offcanvas visibility change. | `string` | **required** | | `placement` | Offcanvas placement. | `start` \| `end` \| `top` \| `bottom` |_start_| | `responsive` | Hide the content in an offcanvas below the breakpoint. | `boolean \| sm \| md \| lg \| xl \| xxl` | _true_ | 4.3.10+ | `scroll` | Allow body scrolling while offcanvas is open. | `boolean` |_false_| | `visible` | Toggle the offcanvas visibility. | `boolean` |_undefined_| | `role` | Html `role` for an offcanvas. | `string` |_dialog_| | `aria-modal` | Set `aria-modal` html attr for an offcanvas. | `string` |_true_|
##### Outputs
| name | description | type | | ---- | ----------- | ---- | | `visibleChange` | Event emitted on `visible` change. | `boolean` |
### c-offcanvas-body _component_ ### c-offcanvas-header _component_ ### cOffcanvasTitle _directive_ ### cOffcanvasToggle _directive_ ##### Inputs
| name | description | type | default | | ---- | ----------- | ---- | ------- | | `cOffcanvasToggle` | Html element `id` attr of an offcanvas to dismiss. | `string` | **required** |
  • GitHub
  • Twitter
  • Support
  • CoreUI (Vanilla)
  • CoreUI for React.js
  • CoreUI for Vue.js

CoreUI for Angular is Open Source UI Components Library for Angular.

Currently v5.4.12 Code licensed MIT , docs CC BY 3.0 .
CoreUI PRO requires a commercial license.