Official Way to Implement Interactions (Tap, Hold, etc.) for Custom Cards?

Hi everyone,

I’m working on a custom picture element state label card and want to implement interactions like tap, double-tap, and hold to change the label’s color, font color, and other properties based on custom parameters.

I’ve reviewed the official custom card documentation and related pages, but I can’t find a clear, official way to handle basic interactions (e.g., tap, hold) for custom elements. The source code for the state label uses an internal handle-action utility, but this isn’t exposed for developers to use directly.

Currently, I’m implementing a custom action handler to process tap and hold events, but this feels like a workaround. Drawbacks are the elements respond differently in different environments (web-browser, HA app) on hold and back actions, which is not happening for standard picture elements. I suspect this is a common need for developers creating custom components.

Question: Is there an official or recommended way to implement interactions (tap, hold, etc.) for custom cards in Home Assistant? If not, are there community-accepted best practices or patterns for handling these events?

Thanks for any insights or examples!

Relevant links:

1 Like