Dark Logo

Urbix

CTRL D
Offcanvas Basic

Use the buttons below to show and hide an offcanvas element via JavaScript that toggles the .show class on an element with the .offcanvas class.

Link with href
Offcanvas
Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
<a class="btn btn-primary" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
        Link with href
    </a>
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
        Button with data-bs-target
    </button>

<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    </div>
    <div class="offcanvas-body">
        <div>
            Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
        </div>
        <div class="dropdown mt-3">
            <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
                Dropdown button
            </button>
            <ul class="dropdown-menu">
                <li><a class="dropdown-item" href="#">Action</a></li>
                <li><a class="dropdown-item" href="#">Another action</a></li>
                <li><a class="dropdown-item" href="#">Something else here</a></li>
            </ul>
        </div>
    </div>
</div>
Body Scrolling

You can also enable <body> scrolling with a visible backdrop.

Backdrop with scrolling

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

<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBothOptions" aria-controls="offcanvasWithBothOptions">Enable both scrolling & backdrop</button>

<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="offcanvasWithBothOptions" aria-labelledby="offcanvasWithBothOptionsLabel">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">Backdrop with scrolling</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    </div>
    <div class="offcanvas-body">
        ...
    </div>
</div>
Static Backdrop

When backdrop is set to static, the offcanvas will not close when clicking outside of it.

Offcanvas
I will not close if you click outside of me.
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#staticBackdrop" aria-controls="staticBackdrop">
    Toggle static offcanvas
</button>

<div class="offcanvas offcanvas-start" data-bs-backdrop="static" tabindex="-1" id="staticBackdrop" aria-labelledby="staticBackdropLabel">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="staticBackdropLabel">Offcanvas</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    </div>
    <div class="offcanvas-body">
        <div>
            ...
        </div>
    </div>
</div>
Body Scrolling & Backdrop

Scrolling the <body> element is disabled when an offcanvas and its backdrop are visible. Use the data-bs-scroll attribute to enable <body> scrolling.

Backdrop with scrolling
Recent Activity 1
New Launch: Smartwatch XYZ

Experience cutting-edge technology with heart rate monitoring, GPS tracking, and customizable watch faces.

Learn More
Recent Activity 2
Flash Sale: Up to 50% off!

Hurry! Limited-time offers on selected items. Don't miss out on great deals!

Shop Now
Recent Activity 3
New Arrivals: Latest Fashion Trends

Update your wardrobe with our stylish new arrivals. Stand out from the crowd!

Explore Collection
Recent Activity 4
Tech Update: Explore New Gadgets

Discover the latest tech innovations that simplify your life and enhance productivity.

See Gadgets
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBothOptions2" aria-controls="offcanvasWithBothOptions2">Enable both scrolling & backdrop</button>

<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="offcanvasWithBothOptions2" aria-labelledby="offcanvasWithBothOptions2Label">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasWithBothOptions2Label">Backdrop with scrolling</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    </div>
    <div class="offcanvas-body">
        ...
    </div>
</div>
Offcanvas Placements

Use Bootstrap's offcanvas component to display content from different directions. Add the offcanvas-start, offcanvas-end, offcanvas-top, or offcanvas-bottom classes to control the placement.

Explore Our Offerings
Recent Activity 1
New Launch: Smartwatch XYZ

Experience cutting-edge technology with heart rate monitoring, GPS tracking, and customizable watch faces.

Learn More
Recent Activity 2
Flash Sale: Up to 50% off!

Hurry! Limited-time offers on selected items. Don't miss out on great deals!

Shop Now
Recent Activity 3
New Arrivals: Latest Fashion Trends

Update your wardrobe with our stylish new arrivals. Stand out from the crowd!

Explore Collection
Recent Activity 4
Tech Update: Explore New Gadgets

Discover the latest tech innovations that simplify your life and enhance productivity.

See Gadgets
Explore Our Offerings
Recent Activity 1
New Launch: Smartwatch XYZ

Experience cutting-edge technology with heart rate monitoring, GPS tracking, and customizable watch faces.

Recent Activity 2
Flash Sale: Up to 50% off!

Hurry! Limited-time offers on selected items. Don't miss out on great deals!

Recent Activity 3
New Arrivals: Fashion Trends

Update your wardrobe with our stylish new arrivals. Stand out from the crowd!

Recent Activity 4
Tech Update: Explore Gadgets

Discover the latest tech innovations that simplify your life and enhance productivity.

Explore Our Offerings
Recent Activity 1
New Launch: Smartwatch XYZ

Experience cutting-edge technology with heart rate monitoring, GPS tracking, and customizable watch faces.

Learn More
Recent Activity 2
Flash Sale: Up to 50% off!

Hurry! Limited-time offers on selected items. Don't miss out on great deals!

Shop Now
Recent Activity 3
New Arrivals: Latest Fashion Trends

Update your wardrobe with our stylish new arrivals. Stand out from the crowd!

Explore Collection
Recent Activity 4
Tech Update: Explore New Gadgets

Discover the latest tech innovations that simplify your life and enhance productivity.

See Gadgets
Explore Our Offerings
Recent Activity 1
New Launch: Smartwatch XYZ

Experience cutting-edge technology with heart rate monitoring, GPS tracking, and customizable watch faces.

Recent Activity 2
Flash Sale: Up to 50% off!

Hurry! Limited-time offers on selected items. Don't miss out on great deals!

Recent Activity 3
New Arrivals: Fashion Trends

Update your wardrobe with our stylish new arrivals. Stand out from the crowd!

Recent Activity 4
Tech Update: Explore Gadgets

Discover the latest tech innovations that simplify your life and enhance productivity.

<div class="d-flex align-items-center gap-3 flex-wrap">
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasStart" aria-controls="offcanvasStart">
        Toggle Start
    </button>
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop" aria-controls="offcanvasTop">
        Toggle Top
    </button>
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasEnd" aria-controls="offcanvasEnd">
        Toggle End
    </button>
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom">
        Toggle Bottom
    </button>
</div>

<!-- start:: Start Offcanvas -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasStart" aria-labelledby="offcanvasStartLabel">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasStartLabel">Explore Our Offerings</h5>
        <button type="button" class="btn-close icon-btn-sm" data-bs-dismiss="offcanvas" aria-label="Close">
            <i class="ri-close-large-line fw-semibold"></i>
        </button>
    </div>

    <div class="offcanvas-body">
        ...
    </div>
</div>
<!-- end:: Start Offcanvas -->

<!-- start:: Top Offcanvas -->
<div class="offcanvas offcanvas-top" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel" style="min-height:481px;">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasStartLabel">Explore Our Offerings</h5>
        <button type="button" class="btn-close icon-btn-sm" data-bs-dismiss="offcanvas" aria-label="Close">
            <i class="ri-close-large-line fw-semibold"></i>
        </button>
    </div>

    <div class="offcanvas-body">
        ...
    </div>
</div>
<!-- end:: Top Offcanvas -->

<!-- start:: End Offcanvas -->
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasEnd" aria-labelledby="offcanvasEndLabel">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasStartLabel">Explore Our Offerings</h5>
        <button type="button" class="btn-close icon-btn-sm" data-bs-dismiss="offcanvas" aria-label="Close">
            <i class="ri-close-large-line fw-semibold"></i>
        </button>
    </div>

    <div class="offcanvas-body">
        ...
    </div>
</div>
<!-- end:: End Offcanvas -->

<!-- start:: Bottom Offcanvas -->
<div class="offcanvas offcanvas-bottom" tabindex="-1" id="offcanvasBottom" aria-labelledby="offcanvasBottomLabel" style="min-height:481px;">
    <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasStartLabel">Explore Our Offerings</h5>
        <button type="button" class="btn-close icon-btn-sm" data-bs-dismiss="offcanvas" aria-label="Close">
            <i class="ri-close-large-line fw-semibold"></i>
        </button>
    </div>

    <div class="offcanvas-body">
        ...
    </div>
</div>

Theme Customization

Layout:
Vertical
Horizontal
Semi Box
Content Width:
Default
Box
Layout Direction:
LTR
RTL
Layout Mode:
Light
Dark
System
Sidebar Size:
Default
Medium
Icon
Icon hover
Sidebar Color:
Light
Dark