Skip to content
pixi-silk
GitHub repository
Class

ButtonDock

import { ButtonDock } from 'pixi-silk/ui/dock';

A row or column of SilkButtons that closes the gap when one hides and opens it when it comes back, gliding the others into place. Slot sizes follow each button’s animated appearance, so the reflow and the fade are one motion. The dock sets each button’s x (row) or y (column), so do not position them yourself.

Extends#

  • Container

Constructors#

Constructor#

new ButtonDock(options?: ButtonDockOptions): ButtonDock;

Parameters#

ParameterType
optionsButtonDockOptions

Returns#

ButtonDock

Overrides#

Container.constructor

Accessors#

buttons#

Get Signature#

get buttons(): readonly SilkButton[];

Buttons in order, hidden ones included.

Returns

readonly SilkButton[]

Methods#

add()#

add(...buttons: SilkButton[]): this;

Appends buttons and adds them as children. A button already in the dock is skipped.

Parameters#

ParameterType
…buttonsSilkButton[]

Returns#

this


destroy()#

destroy(options?: DestroyOptions): void;

Stops the reflow. Pass { children: true } to destroy the buttons too.

Parameters#

ParameterType
options?DestroyOptions

Returns#

void

Overrides#

Container.destroy

hideAll()#

hideAll(): Promise<boolean[]>;

Hides every button, last to first, stagger seconds apart. Resolves with each button’s hide() result.

Returns#

Promise<boolean[]>


remove()#

remove(button: SilkButton): this;

Removes a button from the dock and from its children. It is not destroyed.

Parameters#

ParameterType
buttonSilkButton

Returns#

this


showAll()#

showAll(): Promise<boolean[]>;

Shows every button, first to last, stagger seconds apart. Resolves with each button’s show() result.

Returns#

Promise<boolean[]>


tick()#

tick(dt: number): boolean;

Advances the layout by dt seconds (only needed with ticker: null). Returns true while moving.

Parameters#

ParameterType
dtnumber

Returns#

boolean