1. Reference
  2. Layout

<swipeable>

A list row you swipe away, as in a mail app, revealing a layer behind it as it moves.

Layout

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

swipeable.ham
<column style="gap-1 w-full">
    <swipeable action-dismissleft="$archived = 1">
        <background side="right"
                    style="bg-red flex-row justify-end items-center px-16">
            <icon name="delete white"/>
        </background>
        <row style="p-16 gap-12 items-center bg-gray-100 dark:bg-gray-800">
            <avatar text="MC"
                    size="36"/>
            <text>Maya: Dinner on Friday?</text>
        </row>
    </swipeable>
    <swipeable direction="left">
        <background style="bg-red flex-row justify-end items-center px-16">
            <icon name="delete white"/>
        </background>
        <row style="p-16 gap-12 items-center bg-gray-100 dark:bg-gray-800">
            <avatar text="JR"
                    size="36"
                    color="teal"/>
            <text>Jon: Tickets are booked</text>
        </row>
    </swipeable>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
confirm Condition (same grammar as @show) checked when the threshold is crossed; false snaps the row back. (This tag's own meaning: elsewhere confirm= is the confirm dialog.)
expression
direction Allowed swipe directions; a swipe in a disallowed direction does nothing.
horizontal, left, right, vertical, up, down, none
horizontal
dismiss false = reveal-only: crossing the threshold fires reveal and the row snaps back.
boolean
true
duration Milliseconds for the fling-out.
number
200
resize Milliseconds for the height collapse.
number
300
threshold Fraction of the row's extent the drag must cross to dismiss.
number
0.4

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

Guides and recipes that use it

This page is also Markdown, and all of HAM is in llms.txt.