Fragiola

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

ZoomIn

Flow.ZoomIn zooms the flow in by one step around the centre of the root, and is disabled once the zoom reaches its greatest value.

Flow.ZoomIn renders a button (type="button") that runs the engine's "zoom-in" action: it zooms in by the root's zoomStep (1.2) around the root's centre. At the greatest zoom (maxZoom) the engine refuses it, so the button is disabled (and data-disabled) while engine.can("zoom-in") is false; it re-renders when the view changes. It sets no text and no name: give it an icon and an aria-label. Put it in Flow.Controls, or anywhere inside Flow.Root.

import { PlusIcon } from "lucide-react";

<Flow.ZoomIn aria-label="Zoom in" className="p-1 data-disabled:opacity-40">
    <PlusIcon />
</Flow.ZoomIn>;

The same action from code: engine.run("zoom-in") (engine).

Props

ZoomInProps extends the common primitive props and every button attribute; a disabled of yours disables it too.

proptypedefaultdescription
durationnumber0how long its viewport change animates, in milliseconds (the root's easing); 0: at once
childrenReactNodenoneits icon or label

State

ControlButtonState (Controls), what className, style and render receive:

fieldtypedescription
disabledbooleanthe engine refuses its action now, or its disabled prop is set

Data attributes

attributevalue
data-flow-part"zoom-in"
data-disabledpresent while disabled