new Hamburger(parent, props)
Represents a Hamburger menu component.
| Name | Type | Description |
|---|---|---|
parent | HTMLElement | The parent element to which the hamburger menu is attached.. |
props | TComponents. | The properties of the hamburger menu. |
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();Extends
Members
activeView :string
Gets the currently active view.
- string
- Deprecated
- Use `activeViewName` instead TComponents.Hamburger#activeViewName.
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();
// Get the current active view
const currentActiveView = hamburgerInstance.activeView;
console.log(currentActiveView); // 'View 1'activeViewIndex :number
Sets the active view index and updates the active view in the Hamburger component.
- number
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();
// Get the current active view index
const currentActiveViewIndex = hamburgerInstance.activeViewIndex;
console.log(currentActiveViewIndex); // 0activeViewName :string
Sets the active view by its display name. The comparison is performed against the resolved text from Component_A.dynamicText.
- string
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();
// Get the current active view name
const currentActiveView = hamburgerInstance.activeViewName;
console.log(currentActiveView); // 'View 1'alwaysVisible :boolean
The visibility state of the hamburger menu.
- boolean
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();
// Get the current visibility state
const isAlwaysVisible = hamburgerInstance.alwaysVisible;
console.log(isAlwaysVisible); // true
// Set the visibility state to false
hamburgerInstance.alwaysVisible = false;views :Array.<any>
An array of Hamburger's views, each containing properties like id, name, content, active, and child.
- Array.<any>
- Overrides
- Source
const hamburgerInstance = new TComponents.Hamburger(document.body, {
position: 'absolute',
width: 200,
height: 200,
zIndex: 1000,
views: [
{
name: 'View 1',
icon: 'abb-icon abb-icon-home-house_32',
content: `view_${API.generateUUID()}`,
children: [],
},
{
name: 'View 2',
icon: 'abb-icon abb-icon-folder-open_32',
content: `view_${API.generateUUID()}`,
children: [],
},
],
activeViewIndex: 0,
});
// Render the hamburger menu
hamburgerInstance.render();
// Get the views
const views = hamburgerInstance.views;
console.log(views);Methods
(protected) _setActiveView() → {void}
Removes the “active” style from all hamburger menu buttons, then activates the view at the specified index.
- Source
If the hamburger menu is not initialized or the target view cannot be found.
- Type
- Error
- Type:
- void
(protected) defaultProps() → {TComponents.HamburgerProps}
Returns default properties for the hamburger menu.
- Overrides
- Source
The default properties.
mapComponents() → {object}
Maps components to their identifiers.
- Overrides
- Source
- Type:
- object
markup() → {string}
Generates the HTML markup for the hamburger menu.
- Overrides
- Source
The HTML markup.
- Type:
- string
onInit() → {void}
Initializes the hamburger menu.
- Overrides
- Source
- Type:
- void
onRender() → {void}
Renders the hamburger menu.
- Overrides
- Source
- Type:
- void
(static) loadCssClassFromString(css)
Add css properties to the component
| Name | Type | Description |
|---|---|---|
css | string | The css string to be loaded into style tag |
- Source
TComponents.Hamburger.loadCssClassFromString(/*css* / `
.tc-hamburger {
height: 100%;
width: 100%;
}`
);