Drawer
vig-drawer [vigDrawerFooter] ng-template[vigDrawerContent]
import { Drawer, DrawerFooter, DrawerContent } from '@vigdx/ui/drawer';Basic
[(open)] and give the drawer a heading ; position end slides it in from the end edge (the right one in left-to-right text; unset, it is the physical right edge). A vigDrawerFooter element becomes the pinned action row. Select panels inside work thanks to provideVigdxUi() , as in the dialog.
Positions
position anchors the drawer to the start , end , top or bottom edge. start and end follow the text direction: in a right-to-left layout start is the right edge. The older left and right are deprecated: they are physical edges that never swap.
Navigation drawer
ariaLabel . padding="none" (formerly [padded]="false" ) hands the body spacing to the content, e.g. a full-width navigation list. The X button stays unless closable is off; closeOnBackdropClick and closeOnEscape work as in the dialog.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="drawer"][data-part="panel"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="drawer"]
| Part | Element | data-state |
|---|---|---|
panel | <dialog> ; style the backdrop with ::backdrop . | open, closed |
header | — | |
heading | <h2> of heading . | — |
close | closable ). | — |
body | padding ). | — |
footer | [vigDrawerFooter] row. | — |
| Attribute | Meaning |
|---|---|
data-opening | <dialog> ) while its entrance transition plays; removed once it settles (2s at most). Style the entrance with data-opening: utilities. |
data-closing | data-closing: utilities. |
Accessibility
- Built on the native
<dialog>withshowModal(), likevig-dialog: the page behind is inert and Tab stays inside the drawer. - The drawer is named by its
heading; without one, passariaLabel. - Escape, the X button (
closeAriaLabel) and a backdrop click close it, each unless turned off; focus then returns to the element that opened it. A backdrop click counts only when the press and the release both land outside the drawer, so a text selection dragged out of it does not close it. - Scrolling over the backdrop or past the end of the drawer does not scroll the page.
- The drawer slides in and out; when the user prefers reduced motion it fades instead.
Lazy content
Projected content is created with the vig-drawer, even while it is closed. Wrap a heavy body (a form that loads data, a chart) in <ng-template vigDrawerContent> instead: it is created when the drawer opens and destroyed once it has closed, after the exit transition.
API
Drawer
vig-drawerEdge-anchored modal panel (PrimeNG p-drawer/sidebar territory) on the
native <dialog> element: focus trap, top-layer, Escape and focus restore
come from the platform. Slides in from the chosen edge.
While it plays its entrance or exit transition, the animating element
carries data-opening or data-closing (stable hooks for styling and
for waiting in tests; see the theming guide).
data-opening data-closing
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | — |
closable | boolean | true | — |
closeAriaLabel | string | undefined | undefined | — |
closeOnBackdropClick | boolean | undefined | undefined | Close when the backdrop is clicked (press and release both outside the
box, so dragging a text selection out never dismisses). Default |
closeOnEscape | boolean | true | Close on Escape / the back gesture; off also disables backdrop dismissal natively. |
dismissable | boolean | true | Deprecated: Use `closeOnBackdropClick`; still honored when it is unset. — |
header | string | undefined | undefined | Deprecated: Use `heading`; still honored when `heading` is unset. — |
heading | string | undefined | undefined | Visible title, which also names the panel ( |
height | string | '24rem' | CSS height of |
open | boolean | false | Two-way: drive with a signal, e.g. |
padded | boolean | true | Deprecated: Use `padding` (`[padded]="false"` is `padding="none"`). — |
padding | DrawerPadding | undefined | undefined | Inner spacing of the body: |
position | DrawerPosition | 'right' | Edge the drawer slides in from. The default is the physical right edge
(as in 2.0, until 3.0); prefer |
width | string | '24rem' | CSS width of side ( |
| Name | Payload | Description |
|---|---|---|
openChange | boolean | Two-way: drive with a signal, e.g. |
Templates and directives
| Selector | Export | Description |
|---|---|---|
[vigDrawerFooter] | DrawerFooter | Marks the footer (action row) content of a vig-drawer. |
ng-template[vigDrawerContent] | DrawerContent | Body content of a vig-drawer created only while it is shown: when it opens, and destroyed once it has closed (after the exit transition). Projected content, by contrast, lives as long as the vig-drawer does. Example : |