gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

custom template for form #204

Closed benmonro closed 8 years ago

benmonro commented 8 years ago

is it possible to customize the template for the form? I'd still like to use all the built in features of each field type in tcomb form but I just want to have more control over the form. Something like this:

var MyType = t.struct({ ... my fields ...});
render() {
  return (
  <Form type={MyType} options={options}>
    <div><Form.Field field={MyType.field1} /></div>
   <p><Form.Field field={MyType.field2} /></p>
  </Form>);
}

or something along those lines. I can of course customize the template for each field, but then it's hard to follow where things are. In otherwords, I want all the fields to work the same as they do currently, but I just want to have more control over how/where they're rendered in the form directly inline...

gcanti commented 8 years ago

is it possible to customize the template for the form

Yes, see the formLayout template in the GUIDE as example

benmonro commented 8 years ago

ah thanks! I was looking for 'form template' not form layout. :)