Skip to content

@serenity-is/corelib / CreateWidgetParams

Interface: CreateWidgetParams<TWidget, P>

Defined in: src/ui/widgets/widget.ts:576

Parameters for Widget.create.

Type Parameters

TWidget

TWidget extends Widget<P>

The widget type to create.

P

P

The widget's options type.

Properties

container?

optional container: HTMLElement | ArrayLike<HTMLElement>

Defined in: src/ui/widgets/widget.ts:582

The container to append the widget's element to.


element()?

optional element: (e) => void

Defined in: src/ui/widgets/widget.ts:584

Callback invoked with the created element.

Parameters

e

Fluent

Returns

void


init()?

optional init: (w) => void

Defined in: src/ui/widgets/widget.ts:586

Callback invoked after the widget is initialized.

Parameters

w

TWidget

Returns

void


options?

optional options: P & object

Defined in: src/ui/widgets/widget.ts:580

The options to pass to the widget.

Type Declaration

class?

optional class: string

Optional CSS class(es) for the widget's DOM node.

deferInit?

optional deferInit: boolean

Asks a widget whose class has Attributes.deferInit("optional") to defer its initialization (true), or to initialize in its constructor (false), as its creator can wait for it, e.g. a form that defers its own, or can't. The other classes ignore it, see Widget.isDeferredInit.

element?

optional element: string | HTMLElement | ArrayLike<HTMLElement> | (el) => void

The element to bind the widget to, as an element, array-like, selector or a callback that receives the created element.

id?

optional id: string

Optional id for the widget's DOM node.


type?

optional type: {(options?): TWidget; prototype: TWidget; }

Defined in: src/ui/widgets/widget.ts:578

The widget type to instantiate.

Parameters

options?

P

Returns

TWidget

prototype

prototype: TWidget