composable-form icon indicating copy to clipboard operation
composable-form copied to clipboard

no custom attributes?

Open bgrosse-midokura opened this issue 5 years ago • 3 comments

I need some custom attributes. data-test-id or id or name for e2e tests, and autocomplete to let browsers properly fill out login/signup forms.

I've been using Form.View.custom so far, with CustomConfig and it works out for styling (bootstrap in my case). However, TextFieldConfig etc have only label and placeholder hardcoded into their attributes.

I am kind of lost here. Did I completely miss something? Is this simply not possible without a PR? Or should I start by copypasting the whole of Form.View.custom and everything "under it"?

bgrosse-midokura avatar Jan 28 '20 15:01 bgrosse-midokura

tried at #39

bgrosse-midokura avatar Jan 28 '20 16:01 bgrosse-midokura

I'm in the same boat. I'd like to attach data tags and other attributes to the fields that would effect how they are rendered. As @bgrosse-midokura mentioned, TextFieldConfig.attributes looks a good place to list them but it's type is set to TextField.Attributes, and I don't see how that could be extended.

Updated

In the meantime I found an issue https://github.com/hecrj/composable-form/issues/32 in which @hecrj talk about this. If I understood correctly, the way to go is to define custom fields, i.e. reimplement Form and Form.View. It seems quite a big work though because that means reimplementing all the fields if you only want to have custom attributes.

woochica avatar Jun 03 '20 08:06 woochica

+1

dvekeman avatar Jan 19 '23 13:01 dvekeman