Skip to main content

Reflex Swipe

Detects swipes on the page. Wraps react-swipeable.

from reflex_swipe import swipeable

def index():
    return swipeable(
        "Swipe Here",
        on_swiped_left=rx.console_log("Swiped Left"),
        height="100px",
        width="100px",
    )

Supported Props

Prop Name Prop Type Description
delta float The min distance(px) before a swipe starts.
prevent_scroll_on_swipe bool Prevents scroll during swipe.
track_touch bool Track touch input.
track_mouse bool Track mouse input.
rotation_angle float Set a rotation angle.
swipe_duration float Allowable duration of a swipe (ms).

Supported Events

Event Name Event Type
on_swiped (SwipeEvent) -> Any
on_swiped_left (SwipeEvent) -> Any
on_swiped_right (SwipeEvent) -> Any
on_swiped_up (SwipeEvent) -> Any
on_swiped_down (SwipeEvent) -> Any
on_swiped_start (SwipeEvent) -> Any
on_swiping (SwipeEvent) -> Any
on_tap () -> Any
on_touch_start_or_mouse_down () -> Any
on_touch_end_or_mouse_up () -> Any

SwipeEvent is the following:

class SwipeEvent(TypedDict):
    """A swipe event."""

    # direction of swipe
    dir: Literal["Left", "Right", "Up", "Down"]
    # initial swipe [x,y]
    initial: Tuple[float, float]
    # true for the first event of a tracked swipe
    first: bool
    # x offset (current.x - initial.x)
    delta_x: float
    # y offset (current.y - initial.y)
    delta_y: float
    # absolute delta_x
    abs_x: float
    # absolute delta_y
    abs_y: float
    # √(absX^2 + absY^2) / time - "absolute velocity" (speed)
    velocity: float
    # [ deltaX/time, deltaY/time] - velocity per axis
    vxvy: Tuple[float, float]

Metadata

Release files for reflex-swipe 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reflex-swipe 1.1.2
File Size Uploaded
reflex_swipe-1.1.2.tar.gz 56.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reflex-swipe 1.1.2
File Interpreter ABI Platform
reflex_swipe-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 60.3 kB

Release files / reflex_swipe-1.1.2.tar.gz

Download URL reflex_swipe-1.1.2.tar.gz
Size 56.3 kB
Tags Source
SHA-256 checksum
How to use checksums
802f140b7000bb98428684a2b7fb6afe623e12cef50a5f24adba83601cec84a9
BLAKE2b-256 checksum
How to use checksums
556ecba8b29e45dd53b62571be6bee3b4266dbb4953d08422a13d785096ffc2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.13

Release files / reflex_swipe-1.1.2-py3-none-any.whl

Download URL reflex_swipe-1.1.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdec1eba4c0fb5956ccada1b022b23156809af82979cb42bd5155b535ece3364
BLAKE2b-256 checksum
How to use checksums
e386b8335f5e85daa1e0b3a99faec21ba338621c13ddcb3b50e4f3e731a2acd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.13

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page