Angular Bootstrap 5 Sticky

Sticky is a component which allows elements to be locked in a particular area of the page. It is often used in navigation menus.

Note: Read the API tab to find all available options and advanced customization

Basic example

To start use sticky just use a mdbSticky directive on the element you want to pin

Sticky bottom

You can pin element to bottom by adding [stickyPosition]="'bottom'"


Set [stickyBoundary]="boundary" so that sticky only works inside the parent element. Remember to set the correct parent height.

Outer element as a boundary

You can specify an element to be the sticky boundary.

Stop here


Default direction of sticky component is down. You can change it by setting data-mdb-sticky-direction="up" or data-mdb-sticky-direction="both"

Sticky with navbar

By default, sticky locks the element at the edge of the screen. If you have a navbar element on your website, it will hide behind it. You can prevent this by setting an offset and delay

Sticky - API


        import { MdbStickyModule } from 'mdb-angular-ui-kit/sticky';
        @NgModule ({
          imports: [MdbStickyModule],


Name Type Default Description
stickyActiveClass String '' Set custom active class
stickyBoundary HTMLElement null set the reference of the boundary element
stickyDelay Number 0 Set the number of pixels beyond which the item will be pinned
stickyDirection String 'down' Set the scrolling direction for which the element is to be stikcky
stickyOffset Number 0 Set the distance from the top edge of the element for which the element is sticky
stickyPosition String 'top' Set the edge of the screen the item should stick to


Name Description
active This event fires immediately when sticky start
inactive This event fires immediately when sticky stop

        <div style="min-height: 500px" class="text-center" #boundary>
            class="btn btn-outline-primary bg-white sticky"
            >Download MDB

        onActive() { console.log('active'); }