Skip to content

[Feat]: Add onClick prop to Checkbox component #326

@AregSoft

Description

@AregSoft

Component

Checkbox

Is your feature request related to a problem? Please describe.

Currently, when a Checkbox component is used within a div that also contains a Label, clicking the label can trigger the onClick event on the parent div twice. This double-triggering occurs because the Checkbox and its Label are separate interactive elements, and their click events can both bubble up to the parent container. This behavior is problematic because it can lead to unintended actions or redundant state updates, making it difficult to reliably manage user interactions.

Describe the solution you'd like

To solve this problem, I propose adding a new onClick prop directly to the Checkbox component. This prop would allow developers to handle click events specifically on the checkbox itself, preventing the need for wrapping it in a parent div to capture clicks.

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes

Additional context

No response

Metadata

Metadata

Assignees

Labels

phase / ready-to-goThis issue merged and will be included in the current milestone releasetype / featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions