Make Small Icons Easy to Tap: Enlarging Image Hit Areas with responseRegion or Wrapper Padding (ArkUI)
When a small Image is hard to tap, make its inter
Requirement Description
active/tap area larger while keeping the visual size unchanged.
Background Knowledge
-
responseRegioncan enlarge the component’s hit area beyond its visual bounds. Docs: - Alternatively, wrap the
Imagein a container and enlarge that container’s size or padding, then attach the tap handler to the container.
Implementation Steps
Approach A —
responseRegion
Keep theImagesmall but set a largerresponseRegion { width, height }to expand its hit rectangle.Approach B — Wrapper Container
Put theImageinside aRow/Stack/Container. Increase the wrapper’s padding (or explicit width/height) and place the.onClickon the wrapper, not theImage.(Wearables) Use a minimum tap target of 40–48 vp for comfort on small round screens.
Test with Accessibility tools if applicable (bigger targets improve usability).
Code Snippet / Configuration
Approach A — Using responseRegion
@Entry
@Component
struct Index {
build() {
Column() {
Image($r('app.media.startIcon'))
.width(20)
.height(20)
.onClick(() => {
this.getUIContext().getPromptAction().showToast({ message: 'Triggered' })
})
// Enlarges the interactive/tap area (does not change visual size)
.responseRegion({ width: 200, height: 200 })
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
.backgroundColor(0xDCDCDC)
.padding({ top: 5 })
}
}
Approach B — Wrapper with Padding (attach onClick to wrapper)
@Entry
@Component
struct Index {
build() {
Column() {
// The Row becomes the large tap target
Row() {
Image($r('app.media.startIcon'))
.width(20)
.height(20)
}
.padding({ all: 100 }) // Enlarge actual clickable area via padding
.onClick(() => {
this.getUIContext().getPromptAction().showToast({ message: 'Triggered' })
})
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
.backgroundColor(0xDCDCDC)
.padding({ top: 5 })
}
}
Test Results
- Both approaches allow comfortable tapping even when the icon’s visual size remains 20 vp.
Limitations or Considerations
-
responseRegionenlarges a rectangular region; it doesn’t support arbitrary shapes. - Wrapper approach affects layout if you use margins; prefer padding on the wrapper to grow the hit area without pushing siblings.
- For wearables, keep targets ≥ 40–48 vp and avoid placing critical targets near bezel edges.

Top comments (0)