Fragiola

API: primitives (@fragiola/flow-react, @fragiola/flow-vue, @fragiola/flow-svelte, @fragiola/flow-angular)

SelectionBox

Flow.SelectionBox shows the box selection being drawn, in screen pixels, while selection() selects the nodes it covers.

Flow.SelectionBox goes inside Flow.Root, outside Flow.Viewport (it is in pixels relative to the root), and renders a div only while a box is drawn (selection(): Shift + drag on the pane, or any drag with selection({ boxOnDrag: true })). The nodes it covers are selected, wholly covered or touched by selection({ boxMode }). Give it its look.

<Flow.Root<Types, typeof features> features={features} defaultNodes={nodes}>
    <Flow.Viewport>…</Flow.Viewport>
    <Flow.SelectionBox className="border border-blue-500 bg-blue-500/10" />
</Flow.Root>

Props

SelectionBoxProps extends the common primitive props and every div attribute.

proptypedefaultdescription
childrenReactNodenoneits content

State

SelectionBoxState, what className, style and render receive:

fieldtypedescription
boxRectthe box, in pixels relative to the root

Data attributes

attributevalue
data-flow-part"selection-box"
data-selectingpresent while the box is drawn

Structural style

position: absolute at the box (left, top, width, height) and pointer-events: none.