packages/components/layout/eui-sidebar-toggle/sidebar-toggle.component.ts
Toggle button component for controlling sidebar open/closed state in the application shell. Provides a hamburger menu icon button that expands or collapses the application sidebar. Integrates with EuiAppShellService to manage sidebar state and handle responsive behavior. Automatically manages focus on mobile and tablet devices, directing focus to sidebar when opened. Typically placed in application header or toolbar for consistent sidebar control.
Example :<!-- In header -->
<eui-app>
<eui-app-header>
<eui-header>
<eui-sidebar-toggle></eui-sidebar-toggle>
<eui-header-logo></eui-header-logo>
<eui-header-app appName="MyWorkplace"></eui-header-app>
</eui-header>
</eui-app-header>
</eui-app>
<!-- In toolbar -->
<eui-app-toolbar>
<eui-toolbar>
<eui-sidebar-toggle iconSvgFillColor="primary"></eui-sidebar-toggle>
</eui-toolbar>
</eui-app-toolbar>| encapsulation | ViewEncapsulation.None |
| selector | eui-sidebar-toggle |
| imports |
AsyncPipe
EUI_ICON_BUTTON
|
| templateUrl | ./sidebar-toggle.component.html |
Properties |
Methods |
Inputs |
HostBindings |
| e2eAttr |
Type : string
|
Default value : 'eui-sidebar-toggle'
|
|
Data attribute value for end-to-end testing identification. Applied as data-e2e attribute on the host element for test automation. |
| iconSvgFillColor |
Type : any
|
|
Custom fill color for the toggle icon SVG. Accepts any valid CSS color value to override default icon color. Optional. |
| class |
Type : string
|
Default value : 'eui-sidebar-toggle'
|
| onToggleSidebar | ||||||
onToggleSidebar(event: Event)
|
||||||
|
Parameters :
Returns :
void
|
| asService |
Type : unknown
|
Default value : inject(EuiAppShellService)
|
| name |
Type : string
|
Default value : 'eui-sidebar-toggle'
|
Decorators :
@HostBinding('class')
|