Heads up! These docs are still a work in progress.

FlexiWidget

A widget is a component (such as a tile) that is stored within a target (dropzone). Widgets can be moved around within a target or between targets.

FlexiWidget (component)

Props

NameTypeDescription
classstringThe class names to apply to this widget.
childrenSnippet<[{ widget: FlexiWidgetController, component?: Component, componentProps?: Record<string, any> }]>The content rendered within the widget.
draggablebooleanWhether the widget is draggable.
resizability'none' | 'horizontal' | 'vertical' | 'both'The resizability of the widget.
widthnumberThe width of the widget in units.
heightnumberThe height of the widget in units.
componentComponent<T>The component rendered within the widget.
componentPropsTThe props applied to the component rendered, if it has one.
controllerFlexiWidgetController (bindable)The controller for this widget.
onfirstcreate(controller: FlexiWidgetController) => voidA callback that fires when the widget's controller is first created.

FlexiWidgetController

FlexiWidgetController uses a controller to manage its state and behaviour. You can access the controller via binding to the controller prop or using the onfirstcreate callback.

The FlexiWidgetController allows you to manage the widget directly and carry out actions.

Properties

NameTypeDescription
targetFlexiTargetController | undefinedThe target this widget is under, if any.
adderFlexiAddController | undefinedThe adder this widget is currently being created under, if any.
refHTMLElement | undefinedThe DOM element bound to this widget.
configFlexiWidgetDerivedConfigurationThe reactive configuration of the widget.
isShadowbooleanWhether this widget is a shadow dropzone widget.
isGrabbedbooleanWhether this widget is grabbed.
isResizingbooleanWhether this widget is being resized.
stylestringThe styling to apply to the widget.
currentActionWidgetAction | nullThe current action being performed on the widget.
draggablebooleanWhether the widget is draggable.
resizability'none' | 'horizontal' | 'vertical' | 'both'The resizability of the widget.
widthnumberThe width of the widget in units.
heightnumberThe height of the widget in units.
componentComponent | undefinedThe component rendered within the widget.
componentPropsRecord<string, any> | undefinedThe props applied to the component rendered, if it has one.
snippetSnippet<[{ widget: FlexiWidgetController, component?: Component, componentProps?: Record<string, any> }]> | undefinedThe content rendered within the widget.
classNameClassValue | undefinedThe class name that is applied to this widget.
xnumberThe column (x-coordinate) of the widget.
ynumberThe row (y-coordinate) of the widget.
metadataRecord<string, any> | undefinedThe metadata associated with this widget, if any.

Methods

NameTypeDescription
onpointerdown(event: PointerEvent) => voidEvent handler for when the widget receives a pointerdown event.
ongrabberpointerdown(event: PointerEvent) => voidEvent handler for when one of the widget's grabbers receives a pointerdown event.
onresizerpointerdown(event: PointerEvent) => voidEvent handler for when one of the widget's resizers receives a pointerdown event.
setBounds(x: number, y: number, width: number, height: number) => voidSets the bounds of the widget. This is not intended for use externally.
addGrabber() => { onpointerdown: (event: PointerEvent) => void }Registers a grabber to the widget and returns an object with an `onpointerdown` event handler.
removeGrabber() => voidUnregisters a grabber from the widget.
addResizer() => { onpointerdown: (event: PointerEvent) => void }Registers a resizer to the widget and returns an object with an `onpointerdown` event handler.
removeResizer() => voidUnregisters a resizer from the widget.
delete() => voidDeletes this widget from its target and board.

FlexiWidgetConfiguration

The configuration object for the FlexiWidget component. This is not reactive when invoked as props on the component, so to mutate it reactively you will need to mutate properties on the controller.

Properties

NameTypeDescription
draggablebooleanWhether the widget is draggable. Defaults to true. Reactive property.
resizability'none' | 'horizontal' | 'vertical' | 'both'The resizability of the widget. Defaults to 'both'. Reactive property.
widthnumberThe width of the widget in units. Defaults to 1. Not reactive.
heightnumberThe height of the widget in units. Defaults to 1. Not reactive.
snippetSnippetThe snippet that is rendered by this widget. Reactive property.
componentComponentThe component that is rendered by this widget. Reactive property.
componentPropsRecord<string, any>The props applied to the component rendered, if it has one. Reactive property.
classNameClassValueThe class names to apply to this widget. Reactive property.
xnumberThe column (x-coordinate) of the widget. Not reactive.
ynumberThe row (y-coordinate) of the widget. Not reactive.
metadataRecord<string, any>The metadata associated with this widget, if any. Reactive property.