Window

A window with a title bar and three control buttons. Minimizing hides the window, maximizing makes it fill the screen and closing removes it from the page.

Import

Importing the library registers <pix-window>.

import '@ilusiva/pix';

Basic

Attributes

NameTypeDefaultDescription
labelstring''Text shown in the title bar.
minimizedbooleanfalseHides the window while it stays open. Remove it to show the window again.
maximizedbooleanfalseMakes the window fill the screen.
inactivebooleanfalseMarks the window as not being the one in use, which mutes its title bar.
resizablebooleanfalseLets the window be resized by dragging its edges and corners. Only the right and bottom edges work when the window is not positioned.

Methods

MethodDescription
focusContent(): Promise<void>Moves the keyboard focus into the window: to the first control of its content, such as a field or a terminal, or to the window itself when it has none.
close(): voidFires the close event and removes the window from the page, unless the event is cancelled.
minimize(): voidHides the window, keeping it open, and fires the minimize event.
maximize(): voidMakes the window fill the screen and fires the maximize event. The inline position and size of the window are set aside until it is restored, since they would keep it from filling the screen. Does nothing when the window is already maximized.
restore(): voidReturns a maximized window to the position and size it had and fires the maximize event, the same one that maximizing fires. Does nothing when the window is not maximized, and does not show a minimized window.

Events

NameDescription
closeThe window is about to be removed from the page. Cancel the event to keep it.
minimizeThe window was minimized.
maximizeThe window was maximized or restored to its size.
resizeThe window was resized by dragging an edge or a corner.

Style properties

NameDescription
--pix-window-inset-bottomHeight left free under a maximized window, for a taskbar.
--pix-window-paddingSpace between the border of the window and its content. Defaults to `--pix-space-4`.

Slots

NameDescription
defaultContent of the window.