Closed benmonro closed 8 years ago
label
option: https://github.com/gcanti/tcomb-form/blob/master/GUIDE.md#label
You can use strings or JSX
yes but then I have to define it for each and every field. I want the auto generated labels, I just want to provide a template for the form so that all labels in the form have the same format. something like this maybe:
var options = {labelTemplate: function(locals){ return <div className='blah'><span>{locals.label}</span></div> }};
then every label will have that HTML as opposed to having to define it for each field. I mean I could extract it to a function I suppose, but just thought it'd be nice if tcomb-form did this since then I'd still have to list out each field...
or alternatrively if possible I'd like to do the same thing for the input containers... i.e. provide a template function in which each input will be wrapped...
var options = {itemTemplate: function(locals){ return <div className='blah'><h3>{locals.label}</h3><span>{locals.input}</span></div> }};
I mean I could extract it to a function I suppose
In order to keep the API surface as small as possible I think it's the way to go
@benmonro is this issue still valid?
I'm still of the opinion that it would be nice to be able to provide a label template function. I actually really like the auto generated labels most of the time so it would be nice to provide a simple template just for those without having to modify the default templates etc. which is what I had to end up doing in this case.
I want to use the auto generated labels but I'd like to customize the label template that is used. I have a lot of fields in my form and they all have the same template for the label, but this is a bit different than the default provided by tcomb.