Hi all ![]()
I’m building a custom MainUI widget based on f7-card, and I want the entire card area to be clickable, not just a button or icon inside it.
My goal:
- Clicking anywhere on the card should send a command to an item
- The card still contains labels, icons, and dynamic background styling
- No “dead zones” where clicks are ignored
I currently try to achieve this by placing an oh-link inside the card and stretching it over the full size using absolute positioning and a high z-index.
Here is a simplified version of my widget YAML:
component: f7-card
config:
style:
position: relative
border-radius: var(--f7-card-expandable-border-radius)
aspect-ratio: 2 / 1
margin: 0.5rem
width: calc(100% - 1rem)
slots:
content:
- component: oh-link
config:
action: command
actionItem: =props.controlitem
actionCommand: =({props.commandOn:props.commandOff})[@@props.controlitem] || props.commandOn
style:
position: absolute
top: 0
left: 0
width: 100%
height: 100%
z-index: 1
background: transparent
cursor: pointer
- component: f7-block
config:
style:
position: relative
z-index: 2
display: flex
align-items: center
slots:
default:
- component: f7-icon
config:
f7: =props.icon
- component: f7-block
config:
style:
position: relative
z-index: 2
display: flex
justify-content: center
align-items: center
slots:
default:
- component: Label
config:
text: =props.header
This mostly works, but I’m not sure if this is the recommended or cleanest approach.
Sometimes I run into click issues or layering problems when adding more content.
My questions:
- Is using a full-size
oh-linkoverlay the correct pattern? - Is there a better way to make an entire widget/card clickable in MainUI?
- Are there any gotchas with
z-index,pointer-events, or Framework7 cards?
Any advice or best practices would be greatly appreciated ![]()
Thanks!