baloise / design-system

The Baloise Design System consists of reusable components and a clearly defined visual style, that can be assembled together to build any number of applications.
https://design.baloise.dev
Apache License 2.0
100 stars 27 forks source link

:sparkles: feat(bal-field): disable auto invalidation for bal-field #1270

Closed yannickholzenkamp closed 10 months ago

yannickholzenkamp commented 10 months ago

Summary

If the Design System configuration is set to default (form.setInvalid: true) all fields that are touched will be displayed as invalid if they have an error. That means the fields are displayed as red.

There are certain fields for which an application engineer wants to have a validation (e.g. required) but does not want the field to be displayed as red when they are touched.

Setting the whole projects config to "setInvalid: false" would be possible but it's a bit too much because I just want to disable the invalidation-behaviour for one single field.

Use Case

Checkbox for accepting data privacy at the end of a form before submitting. The checkbox is blocking for the submit button and has a required validation. The text of the checkbox contains a link to open the privacy terms. If the checkbox or link is clicked the checkbox might be marked as touched. Therefore it's displayed as red - I don't want that though.

Preferred Solution

Property on "bal-field" to disable the auto invalidation for that field.

Additional Information

No response

Will this feature introduce breaking changes?

None

Code of Conduct

hirsch88 commented 10 months ago

/cib

github-actions[bot] commented 10 months ago

Branch feat/issue-1270 created!