Class: Modal

Modal

Class that represents a PixiJS Modal.

Creates an instance of a Modal.

Name Type Description
opts object optional

An options object to specify to style and behaviour of the modal.

Name Type Default Description
id number auto generated optional

The id of the modal.

app PIXIApp window.app optional

The app where the modal belongs to.

backgroundFill number Theme.background optional

The color of the background.

backgroundFillAlpha number 0.6 optional

The opacity of the background.

closeOnBackground boolean true optional

Should the modal be closed when the user clicks the background?

visible boolean true optional

Is the modal initially visible (property visible)?

See:
Example
// Create the button and the modal when clicked
const button = new Button({
    label: 'Show Modal',
    action: e => {
        const modal = new Modal({
            app: app,
            header: 'This is the header',
            content: 'This is the text.'
        })
        app.scene.addChild(modal)
    }
})

// Add the button to a DisplayObject
app.scene.addChild(button)

Extends

Members

content string | PIXI.DisplayObject overrides

Sets or gets the content. The getter always returns an PIXI.DisplayObject. The setter can receive a string or a PIXI.DisplayObject.

Sets or gets the header. The getter always returns a PIXI.Text object. The setter can receive a string or a PIXI.Text object.

Methods

Hides the modal (sets his alpha values to 0).

Returns:
Type Description
Modal A reference to the modal for chaining.

Should be called to refresh the layout of the modal. Can be used after resizing.

Returns:
Type Description
Modal A reference to the modal for chaining.

Shows the modal (sets his alpha values to 1).

Returns:
Type Description
Modal A reference to the modal for chaining.