CngxDrawerPanel
projects/common/layout/drawer/drawer-panel.directive.ts
Import#
import { CngxDrawerPanel } from '@cngx/common/layout'
Description#
The sliding panel of a drawer. Reads its open state from an explicit
[cngxDrawerPanel] reference - no ancestor injection.
Composes CngxFocusTrap as a hostDirective - the consumer controls
the [enabled] and [autoFocus] inputs from the template.
Optionally closes the drawer when the user clicks outside the panel
(closeOnClickOutside, default true).
<nav [cngxDrawerPanel]="drawer" position="left" mode="over"
[enabled]="drawer.opened()" [autoFocus]="true">
<a href="/home">Home</a>
</nav>Metadata#
Host#
Index#
Derived State
Inputs#
Whether clicking outside the panel closes the drawer.
trueCngxDrawerReference to the parent CngxDrawer state owner.
{ alias: 'cngxDrawerPanel' }DrawerModeHow the panel interacts with the content area:
'over'(default) - overlays content (absolute positioned)'push'- pushes content aside (content gets margin)'side'- always visible, no toggle behavior
'over'HostBindings#
| Binding | Expression |
|---|---|
[class.cngx-drawer-panel] | true |
[class.cngx-drawer-panel--open] | isOpen() |
[class.cngx-drawer-panel--left] | position() === 'left' |
[class.cngx-drawer-panel--right] | position() === 'right' |
[class.cngx-drawer-panel--top] | position() === 'top' |
[class.cngx-drawer-panel--bottom] | position() === 'bottom' |
[class.cngx-drawer-panel--over] | mode() === 'over' |
[class.cngx-drawer-panel--push] | mode() === 'push' |
[class.cngx-drawer-panel--side] | mode() === 'side' |
[attr.aria-hidden] | mode() === 'side' ? null : !isOpen() |