Fragiola

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

ZoomOut

Flow.ZoomOut zooms the flow out by one step around the centre of the root, and is disabled once the zoom reaches its least value.

Flow.ZoomOut renders a button (type="button") that runs the engine's "zoom-out" action: it zooms out by the root's zoomStep (1.2) around the root's centre. At the least zoom (minZoom) the engine refuses it, so the button is disabled (and data-disabled) while engine.can("zoom-out") 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 { MinusIcon } from "lucide-react";

<Flow.ZoomOut aria-label="Zoom out" className="p-1 data-disabled:opacity-40">
    <MinusIcon />
</Flow.ZoomOut>;

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

Props

ZoomOutProps 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-out"
data-disabledpresent while disabled