newforms-bootstrap icon indicating copy to clipboard operation
newforms-bootstrap copied to clipboard

How to create `form-horizontal`?

Open darthwade opened this issue 9 years ago • 4 comments

Hi,

How to create form-horizontal for BS3?

Thanks for awesome library. :)

darthwade avatar Apr 14 '15 20:04 darthwade

Support for this is yet to be added, as per the TODO in the README.

I was considering borrowing this configuration idea from @gcanti's tcomb-form, which would result in an API something like:

  render() {
    return <form className="form-horizontal" onSubmit={this._onSubmit}>
      <forms.RenderForm form={SignupForm} ref="signupForm">
        <BootstrapForm horizontal={{
          md: [3, 9],
          sm: [6, 6]
        }}/>
      </forms.RenderForm>
      <button>Sign Up</button>
    </form>
  }

insin avatar Apr 16 '15 11:04 insin

+1

catskul avatar Jul 21 '15 18:07 catskul

Added this and some other things in my PR, #8. The API is basically what you said @insin, except you don't need to specify the 12-n for the label, so just:

<BootstrapForm horizontal={{sm: 10 }} />

I had to build on top of 1.11 since we haven't been able to upgrade react, but I think it was a pretty small change to 2.0.0 that could be re-added.

seanadkinson avatar Aug 13 '15 16:08 seanadkinson

I tried my hand at rebasing your work against 2.0: https://github.com/insin/newforms-bootstrap/pull/9

catskul avatar Sep 26 '15 03:09 catskul