Visibility API
Show, hide, and check the widget's visibility state at runtime.
The visibility API controls whether the widget is shown or hidden. Access it through instance.visibility.
Properties
| Property | Type | Description |
|---|---|---|
isHidden | boolean | Whether the widget is currently hidden |
Methods
| Method | Description |
|---|---|
show() | Show the widget (set isHidden to false) |
hide() | Hide the widget (set isHidden to true) |
Usage
// Check state
if (instance.visibility.isHidden) {
instance.visibility.show();
}
// Toggle
instance.visibility.show();
instance.visibility.hide();
Events
Visibility changes emit events:
import { BordaEvent } from '@retoo/borda';
instance.api.events.on(BordaEvent.ON_VISIBILITY_SHOW, () => {
console.log('Visible');
});
instance.api.events.on(BordaEvent.ON_VISIBILITY_HIDE, () => {
console.log('Hidden');
});