CoreUI Angular Logo
Framework:
  • JavaScript / Vanilla JS
  • React.js
  • Vue.js
Getting startedIntroductionSupport CoreUICustomizeSassOptionsCSS VariablesLayoutBreakpointsContainersGridColumnsGuttersFormsOverviewDate PickerPRODate Range PickerPROForm ControlSelectMulti SelectPROChecks & RadiosPassword InputPRORangeRange SliderPRORatingPROStepperPROInput GroupFloating LabelsLayoutTime PickerPROValidationComponentsAccordionAlertAvatarBadgeBreadcrumbButtonButton GroupCalendarPROCalloutCardCarouselClose buttonCollapseDropdownFooterHeaderImageList GroupLoading ButtonPROModalNavNavbarOffcanvasPaginationPlaceholderPopoverProgressSmart PaginationPROSmart TablePROSidebarSpinnerTableTabsNewToastTooltipWidgetsIconsChartsTemplatesNewAdmin & DashboardDownloadInstallationCustomizeContentMigrationv4 → v5v3 → v4Angular version


DownloadHire UsGet CoreUI PRO
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.

Offcanvas Header

Content for the offcanvas goes here. You can place just about any CoreUI component or custom elements here.

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
Offcanvas Header

Content for the offcanvas goes here. You can place just about any CoreUI component or custom elements here.

Offcanvas Header

Content for the offcanvas goes here. You can place just about any CoreUI component or custom elements here.

Offcanvas Header

Content for the offcanvas goes here. You can place just about any CoreUI component or custom elements here.

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.

Offcanvas Header

Try scrolling the rest of the page to see this option in action.

Offcanvas Header

Try scrolling the rest of the page to see this option in action.

Loading...
Loading...

Static Backdrop

With backdrop prop set to static, the offcanvas will not close when clicking outside of it nor pressing Esc.

Offcanvas Header

I will not close if you try to click outside of me or to press escape key.

Loading...
Loading...

Responsive

Responsive offcanvas hides the content outside the viewport below the specified breakpoint. Above that breakpoint, the content is displayed as usual.

Resize your browser to show the responsive offcanvas toggle button.
Responsive offcanvas Header

This is content within an offcanvas with responsive="lg" property.

Loading...
Loading...

Dark offcanvas

With .text-bg-dark utility class you can change the appearance of your offcanvas component.

Dark Offcanvas Header

Content for the dark offcanvas goes here.

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

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.5.1 Code licensed MIT , docs CC BY 3.0 .
CoreUI PRO requires a commercial license.