axa-ch-webhub-cloud / pattern-library

AXA CH UI component library. Please share, comment, create issues and work with us!
https://axa-ch-webhub-cloud.github.io/plib-feature/develop
126 stars 18 forks source link

Add better documentation for `allowedFileTypes` on the AXAFileUpload #2401

Closed corsin-ragettli closed 2 weeks ago

corsin-ragettli commented 1 year ago

Currently, the documentation (Storybook) only states the following about allowedFileTypes:

In the allowedFileTypes attribute, you can declare the allowed file types that a user can upload (ex: only pdf's are allowed). If the attribute is empty, every file type is allowed.

The user can only guess which format this attribute should have. According to mozilla file inputs accept both extensions (i.E. .docx) or MIME types (i.E. image/png). After some testing I found out only the latter was true for the AXAFileUpload. My suggestion is to change the documentation so the user understands how to correctly use this attribute.

My suggestion:

In the allowedFileTypes attribute, you can declare the allowed file types that a user can upload (ex: only pdf's are allowed). If the attribute is empty, every file type is allowed. The allowed File types should be in the MIME Standard. The allowed file types should be separated by a , for example text/plain, image/jpeg, image/png.

MKaHead commented 1 year ago

Thank you @corsin-ragettli. We will update the docs.