Skip to content

Opening, closing and toggling the bar

open() async

Open bar. Resolves after the bar has opened.

ArgumentTypeDefaultDescription
barBartenderBar | stringBar instance or name
keepOtherBarsOpenbooleanfalseKeep other non-modal bars open?
javascript
bartender.open('mobileNav')

// Open bar without closing the other bars
bartender.open('mobileNav', true)

close() async

Close bar. If bar is undefined, the topmost modal bar will be closed. Resolves after the bar has closed.

ArgumentTypeDefaultDescription
barBartenderBar | string | undefinedBar instance or name
javascript
// Close bar 'mobileNav'
bartender.close('mobileNav')

// Close the topmost modal bar
bartender.close()

closeAll() async

Close all bars. Resolves after all the bars have been closed. By default only modal bars will be closed.

ArgumentTypeDefaultDescription
closeNonModalBarsbooleanfalseClose non-modal bars in addition to the modal bars?
javascript
// Close all non-modal bars
bartender.closeAll()

// Close all bars, including the non-modal
bartender.closeAll(true)

toggle() async

Toggle bar open/closed state. Resolves after the bar has opened or closed.

ArgumentTypeDefaultDescription
barBartenderBar | stringBar instance or name
keepOtherBarsOpenbooleanfalseKeep other non-modal bars open?
javascript
bartender.toggle('mobileNav')

// Toggle bar without closing the other bars
bartender.toggle('mobileNav', true)

Released under the MIT License.