Milk Admin

Template: Offcanvas

An offcanvas is a sidebar that opens to the right of the page. This sidebar is managed by javascript.

The contents shown are like element details or form edits.

<button class="btn btn-primary" onclick="offcanvasTest1()">Show Offcanvas</button>
<script>
function offcanvasTest1() {
window.offcanvasEnd.show()
window.offcanvasEnd.title('Offcanvas Test')
window.offcanvasEnd.body(`<button class="btn btn-primary" onclick="window.offcanvasEnd.hide()">Hide Offcanvas</button>`);
}
</script>


Properties

The Offcanvas class is instantiated in window.offcanvasEnd and provides the following methods:

  • show() - shows the sidebar
  • hide() - hides the sidebar
  • title() - sets the title of the sidebar
  • body() - sets the content of the sidebar
  • size() - sets the size of the sidebar xl | empty
Loading...