Opening, closing and toggling the bar
open() async
Open bar. Resolves after the bar has opened.
| Argument | Type | Default | Description |
|---|---|---|---|
| bar | BartenderBar | string | Bar instance or name | |
| keepOtherBarsOpen | boolean | false | Keep 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.
| Argument | Type | Default | Description |
|---|---|---|---|
| bar | BartenderBar | string | undefined | Bar 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.
| Argument | Type | Default | Description |
|---|---|---|---|
| closeNonModalBars | boolean | false | Close 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.
| Argument | Type | Default | Description |
|---|---|---|---|
| bar | BartenderBar | string | Bar instance or name | |
| keepOtherBarsOpen | boolean | false | Keep other non-modal bars open? |
javascript
bartender.toggle('mobileNav')
// Toggle bar without closing the other bars
bartender.toggle('mobileNav', true)