React Bootstrap Offcanvas Component

Offcanvas with Bootstrap Styling

CoreUI PRO for React.js & Bootstrap

Bootstrap 5 components designed for React.js

This component is part of the CoreUI for React.js UI components library, which offers all Bootstrap components designed to work seamlessly with React.js.

If you want to use Bootstrap 5 in a React.js environment while also needing advanced components that Bootstrap does not offer and dedicated developer support, then this library is the best solution for you.

Learn how to use the React Bootstrap Offcanvas component from CoreUI to create hidden sidebars and sliding panels for navigation, shopping carts, or any additional UI element.

React Bootstrap Offcanvas examples#

The React Bootstrap Offcanvas component allows you to build sidebar-like panels that slide into view from any edge of the screen. These panels are great for navigation menus, shopping carts, and more.

Static offcanvas component#

Here’s a React Bootstrap Offcanvas that is shown by default using visible={true}. It includes a header with a close button and a padded body.

Live demo#

Click the buttons to toggle visibility of the offcanvas.

Scrollable body#

Use the scroll prop to allow page scrolling while the offcanvas is visible. Combine it with backdrop to control overlay behavior.

Scrollable body with backdrop#

Static backdrop#

Prevent closing the React Bootstrap Offcanvas on backdrop click by setting backdrop="static".

Dark variant#

Add the dark prop to match the React Bootstrap Offcanvas with dark themes or layouts.

Responsive behavior#

Use the responsive prop to show the offcanvas below specific breakpoints (e.g., responsive="lg"). Above that breakpoint, the offcanvas behaves as a regular visible container.

Placement options for React Bootstrap Offcanvas#

Choose the offcanvas placement with the placement prop:

  • placement="start" – left
  • placement="end" – right
  • placement="top" – top
  • placement="bottom" – bottom

Examples:

Accessibility considerations#

React Bootstrap Offcanvas behaves like a modal. Use aria-labelledby to link the offcanvas title to assistive technologies. CoreUI automatically adds role="dialog" and other ARIA attributes for accessibility.

API reference#

Review the full API for the React Bootstrap Offcanvas component and its parts: