Halogen.Widgets.Compare
- Package
- purescript-halogen-widgets
- Repository
- afcondon/purescript-halogen-widgets
A controlled before/after comparison wipe — the draggable-divider widget used for before/after image pairs (and any two registered, spatially overlaid renderings). A vertical handle splits the box: the before layer shows to its left, the after layer to its right. Dragging the handle requests a new divider position; the parent owns it.
Both layers are HH.PlainHTML — static content with no actions. That is
the whole point of a comparison wipe (you compare two renderings, you
don't interact through them), and it is what lets this be a proper leaf
component on the contract: the widget owns the drag (document-level
mousemove/mouseup, like Knob), while the caller's content arrives as
inert HTML rather than through a children channel the type system lacks.
Geometry is plain CSS: two absolutely-positioned layers, the before one
clipped with clip-path: inset(...) so its content keeps full width rather
than squashing. The handle position is read back from the container's
bounding rect on each move (library FFI via getBoundingClientRect).
#Input Source
type Input = { after :: PlainHTML, afterLabel :: Maybe String, before :: PlainHTML, beforeLabel :: Maybe String, disabled :: Boolean, height :: String, position :: Number }Controlled input. The parent owns position (0–100, the divider as a
percentage from the left); the two layers and the chrome are config.
- Modules
- Halogen.
Widgets. Accordion. Internal - Halogen.
Widgets. Compare - Halogen.
Widgets. DoubleKnob - Halogen.
Widgets. Field - Halogen.
Widgets. HAccordion - Halogen.
Widgets. Knob - Halogen.
Widgets. Modal - Halogen.
Widgets. Motion - Halogen.
Widgets. Panel - Halogen.
Widgets. SegmentedControl - Halogen.
Widgets. Select - Halogen.
Widgets. Slider - Halogen.
Widgets. Stepper - Halogen.
Widgets. Style - Halogen.
Widgets. Toast - Halogen.
Widgets. Toggle - Halogen.
Widgets. VAccordion