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

FlexiTarget

A ‘target’ for widgets, or a dropzone. Stores a series of widget instances in a managed grid layout.

FlexiTarget (component)

Props

NameTypeDescription
headerSnippet<[{ target: FlexiTargetController }]>The header content of the target, above the grid.
childrenSnippetThe child content of the target, which should contain inner FlexiWidget definitions.
footerSnippet<[{ target: FlexiTargetController }]>The footer content of the target, below the grid.
containerClassstringThe class names to apply to the target's container element.
classstringThe class names to apply to the target's root element.
configFlexiTargetConfigurationThe configuration object for the target.
keystringThe unique identifier for the target. Used to identify the target when layouts are imported or exported.
controllerFlexiBoardController (bindable)The controller for the board.
onfirstcreate(controller: FlexiBoardController) => voidA callback that fires when the board's controller is first created.

FlexiTargetController

FlexiTargetController 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 FlexiTargetController allows you to manage the target directly and carry out actions.

Properties

NameTypeDescription
widgetsSvelteSet<FlexiWidgetController>The widgets currently in this target.
configFlexiTargetConfigurationThe reactive configuration of the target.
providerWidgetDefaultsFlexiWidgetDefaults | undefinedThe reactive default widget configuration passed through from the provider, if it exists.
preparedbooleanWhether the target is prepared and ready to render widgets.

Methods

NameTypeDescription
createWidget(config: FlexiWidgetConfiguration) => FlexiWidgetController | undefinedCreates a new widget under this target.
deleteWidget(widget: FlexiWidgetController) => booleanDeletes the given widget from this target, if it exists.
restorePreGrabSnapshot() => voidRestores the target to its pre-grab state. This is not intended for external use.
forgetPreGrabSnapshot() => voidForgets the pre-grab state of the target. This is not intended for external use.
dropWidget(widget: FlexiWidgetController) => booleanAttempts to drop a widget into this target.
grabWidget(params: WidgetGrabbedParams) => WidgetAction | nullGrabs a widget.
startResizeWidget(params: WidgetStartResizeParams) => WidgetAction | nullStarts resizing a widget.

FlexiTargetConfiguration

The configuration object for the FlexiTarget component, which supports reactivity where specified.

To use reactivity, ensure that the config prop has a reactive source (proxy).

Properties

NameTypeDescription
rowSizingstring | ({ target, grid }: { target: FlexiTargetController, grid: FlexiGrid }) => stringAllows the specifying of the value inside the `repeat()` function of the `grid-template-rows` CSS property for the target. Defaults to 'minmax(1rem, auto)'. Reactive.
columnSizingstring | ({ target, grid }: { target: FlexiTargetController, grid: FlexiGrid }) => stringAllows the specifying of the value inside the `repeat()` function of the `grid-template-columns` CSS property for the target. Defaults to 'minmax(0, 1fr)'. Reactive.
baseColumnsnumberThe base number of columns for the target's grid. Defaults to 1. Not reactive.
baseRowsnumberThe base number of rows for the target's grid. Defaults to 1. Not reactive.
layoutTargetLayoutThe layout algorithm and parameters to use for the target grid. Reactive.
widgetDefaultsFlexiWidgetDefaultsThe default configuration for widgets. Reactive.

FlexiWidgetDefaults

The default configuration for widgets.

Properties

NameTypeDescription
draggablebooleanWhether the widget is draggable. Defaults to true. Reactive.
resizability'none' | 'horizontal' | 'vertical' | 'both'The resizability of the widget. Defaults to 'both'. Reactive.
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.
componentComponentThe component that is rendered by this widget. Reactive.
componentPropsRecord<string, any>The props applied to the component rendered, if it has one. Reactive.
classNameClassValueThe class names to apply to this widget. Reactive.