šŸ”„ Simple Swipe Card - A Custom Card for Easy Card Navigation

Hey everyone! :wave:

I’m excited to share Simple Swipe Card, a new custom card I developed. This card lets you add multiple cards in a container and swipe between them - perfect for saving dashboard space!

Why I Made This Card :thinking:

I previously used swipe-card, but kept running into the infamous ā€œt.setconfig is not a functionā€ error. It was frustrating enough that I decided to build my own swipe card from scratch.

My version doesn’t use the Swiper library and has fewer bells and whistles, but it’s reliable and does exactly what I need it to.

Features :sparkles:

  • Swipe between multiple cards
  • Pagination dots for visual reference
  • Configurable card spacing
  • Full visual editor support
  • Mobile-friendly touch and mouse navigation

simple-swipe-card-example

Configuration Example :clipboard:

You can configure the card using the visual editor or with YAML:

type: custom:simple-swipe-card
cards:
  - type: weather-forecast
    entity: weather.home
  - type: entities
    entities:
      - sensor.temperature
      - sensor.humidity
show_pagination: true
card_spacing: 15

Visual Editor :paintbrush:

The card also includes a visual editor with a card picker for easy configuration from the dashboard without the need to edit any yaml. Please see the Github repository for a screenshot.

Installation & More Information :package:

All installation instructions, configuration details, and customization options are in the GitHub repository:

:point_right: GitHub - nutteloost/simple-swipe-card: A swipeable container for multiple cards with touch and mouse gesture support.

Looking forward to seeing how you use this card in your dashboards! If you have any feedback or run into issues, please let me know.

10 Likes

I have just found your post as I struggle with swiper on mobile.
Will try it tonight and bring some feedback but thank you very much for it!

Simple Swipe Card v1.4.0 is released today!

New Features

  • Added Loopback Mode that allows continuous navigation through cards
  • Added support for Vertical Swiping in addition to the default horizontal swiping

Both new features are fully configurable through the visual editor with intuitive controls and real-time preview.

2 Likes

Another release with a new requested feature released today!

Simple Swipe Card v1.5.0

New Features :sparkles:

  • Added Automatic Slideshow (Auto-Swipe) functionality:
    • Cards can now cycle automatically at a user-defined interval (in milliseconds, minimum 500ms)
    • Auto-swipe intelligently pauses during manual user interaction (e.g., manual swipe, pagination click) and resumes after 5 seconds
    • Integrates with Loopback Mode: When enable_loopback is active, auto-swipe continuously cycles forward through the cards
    • Implements ā€œPing-Pongā€ Mode: If loopback is disabled, auto-swipe will reverse direction upon reaching the first or last card
    • All auto-swipe settings are fully configurable through new options in the visual editor

Improvements :hammer_and_wrench:

  • Core Logic: Enhanced robustness in internal card data handling and layout calculations, particularly concerning the total number of configured cards for greater stability.
1 Like

Simple Swipe Card now supports card_mod and customization through 25 CSS variables!

Simple Swipe Card v1.6.0

New Features :sparkles:

  • Added Card-Mod Integration for advanced styling and theming:
    • Full support for card_mod configuration in card YAML for custom styling
    • CSS Variable Forwarding: Pagination and other styling variables are automatically forwarded from host to shadow DOM
    • Dynamic Style Application: Real-time style updates when card-mod configurations change

Improvements :hammer_and_wrench:

  • Enhanced Styling System: Card-mod styles now take precedence over theme variables, allowing for both global theming and per-card customization
  • Modified slide background to transparent to prevent interference with nested card styling

Well, I needed a way to alternate daily and hourly weather card , this seems perfect. Install was flawless , will test more … So far so good !

Simple Swipe Card v2.0.0

New Features :sparkles:

  • State Synchronization: Sync card position with Home Assistant input_select or input_number entities for external control. This allows you to control which card is displayed from automations, scripts, or other dashboard elements. For example, create an input_select with options ā€œLiving Roomā€, ā€œKitchenā€, ā€œBedroomā€ to automatically switch between camera feeds, or use an automation to show weather cards during the day and security cards at night.

Improvements :hammer_and_wrench:

  • Complete Code Refactor: Rebuilt with modular architecture for better maintainability and performance
  • Optimized Card Loading: All visible cards now load upfront for smoother animations and better performance

Bug Fixes :adhesive_bandage:

  • Initial Display Animation: Fixed swipe animation not working properly on first load when more than three cards are present (closes #15 )
1 Like

State Sync is so awesome! I’m now able to auto-swipe to the room I’m in using my bluetooth tracker. Also created buttons to jump-swipe straight to a room. Really loving this. Thx!

2 Likes

Simple Swipe Card v2.1.0 - v2.4.0

New Features :sparkles:

  • Advanced Pagination Customization: Introduced 20 more CSS variables for pagination dot styling, including support for borders, shadows, hover effects, and custom shapes. Eight detailed examples are provided in the README to inspire your custom designs.

  • Enhanced Loop Modes: Replaced the simple enable_loopback boolean with a comprehensive loop_mode system offering three distinct behaviors:

    • none: Stop at first/last card (no looping)
    • loopback: Jump back to first/last card when reaching edges
    • infinite: Continuous seamless loop navigation for uninterrupted browsing
  • Responsive Carousel Configuration: Introduced card_min_width option for carousel mode that automatically adjusts the number of visible cards based on screen size. Set a minimum card width (e.g., card_min_width: 220) and the carousel automatically adjusts to prevent content cutoff on smaller screens while optimizing card display for available space. This replaces the cards_visible option, which continues to work for backwards compatibility. (closes #23) (closes #5 )

Carousel mode:

Carousel view mode

Single mode:

Single view mode

Improvements :hammer_and_wrench:

  • Smart Configuration Migration: Users with existing cards_visible configurations see a helpful status indicator in the visual editor. When they adjust the new card_min_width setting, the configuration automatically migrates to the responsive approach while preserving their preferences.

  • Offline Compatibility: Completely rewrote the dependency system to use Home Assistant’s built-in dependencies, eliminating the need for external CDN resources. The card now works entirely offline and loads faster by leveraging HA’s internal LitElement libraries instead of downloading from external sources or use them as a fallback.

Bug Fixes :adhesive_bandage:

  • Pagination Dot Alignment: Fixed pagination dots alignment issues when using card_mod custom CSS variables with larger dot sizes. Dots and its container now maintain proper positioning regardless of custom sizing.

  • Auto-swipe Overshoot Fix: Resolved issue where auto-swipe would overshoot and show partial content of the next card instead of properly centering on the target card. Now calculates card dimensions accurately at each swipe transition (closes #24)

  • Swipe Navigation: Fixed intermittent swipe navigation failures on desktop/PC browsers where swipe gestures wouldn’t complete successfully. Enhanced click prevention system now properly distinguishes between intentional swipes and browser navigation attempts (closes #25)

3 Likes

Really like your work most specially the State Synchronization!! One thing that I noticed is that swipe seem to get stuck (swipe gesture seemed to stop working) when i have an iframe with an embedded youtube video in it. i have to tap on the navigation page to get to other cards which is a hassle. also tried to put the iframe inside a vertical-stack card but no dice. sample code below.

type: custom:simple-swipe-card
state_entity: input_number.mediascreen
cards:
  - type: button
    tap_action:
      action: toggle
    entity: switch.sample_lights
  - type: iframe
    url: >-
      https://www.youtube.com/embed/videoseries?list=PLK4IVkm259BYcUvmEYhIozmikhvdHsSuY
  - type: light
    entity: light._downlights

Thanks for the feedback. Unfortunately iframe cards are really problematic when it comes to swipe gestures as the iframe content captures all mouse/touch events, especially the Youtube videos, which prevents the swipe detection from working properly.

I’ve tried several approaches to work around this issue, but none have been working reliably so far… I’ll keep looking for a proper solution, but for now I’m not able to fix it. The only alternative now is to use the pagination dots for navigation from the iframe card to another card. Hopefully I’m able to fix if in a future release.

1 Like

Awesome card, just what I’ve been looking for! Is there any way to define the ā€˜start’ card? Say I have 5 cards but I want to default to card 3 as the one that displayed by default or when the dashboard loads?

You can easily change the order of the cards in the visual editor. Or you can link a state synchronization entity to the card and default that entity to card #3. When the dashboard refreshes it will jump to card #3, but when you manually interact with the Simple Swipe card it will also change the linked state sync entity…

Hi. When using state sync I’ve noticed that when changing between pages you get the scroll animation each time because it’s jumping back to a specific card. Is there some way of not having this initial animation? It just immediately being on the correct card from the start?

Thanks for the reply! I’m still learning at the whole YAML thing, would I include the state sync entity at the start of the card code? Something like:

type: custom:simple-swipe-card
card_spacing: 10
loop_mode: infinite
state_entity: ?

not sure what the exact wording should be…

I just released v2.5.3 in which I fixed this issue.

## Simple Swipe Card v2.5.3

### Improvements šŸ› ļø

- **State Synchronization Positioning:** When a state synchronization entity is linked, the card will no longer 'jump' to the set card position. This was unwanted behavior. When refreshing or returning to the dashboard, the card will just load at the correct position instead of jumping or showing an animation.

@DGTron , just like that. But you still need to create your own input_number.* or 'input_select.*` entity if you want to use this feature.
If you’re having trouble with yaml, you can check the readme for example configurations or use the visual editor to configure you card.

1 Like

That’s marvelous thanks for all your efforts on this. I was looking for an alternative to swipe card that has become more unreliable with new HA versions. I’m configuring it now - I use a few conditional cards in the swipe area so will be interesting to see how it copes :slight_smile:

One initial question on this. I don’t think you currently support cross fading as the animation between cards. Is this possible to implement in a future release? I use a cross fade as it’s less jarring in my dashboards. I find an auto swipe useful to cycle between info displays in limited space but a cross fade is gentler - if that makes sense?

Thanks.

Thank you for the suggestion!

I’m interested in adding different transition modes in a future release, but this would require substantial changes to the core animation system and may take some time to implement properly.

1 Like

Yes understand that. Even if you could do a simple jump cut between cards, (if that makes sense?) would be nice if you could do it in the future. In the meantime I’ll just use the auto swiping function. Thanks.