adamwathan / bootforms

Rapid form generation with Bootstrap 3 and Laravel.
MIT License
417 stars 103 forks source link

Inputs widths #98

Closed larbous closed 8 years ago

larbous commented 8 years ago

Is it possible to define widths to inputs or selects using bootstrap classes. All inputs occupy the whole line and a field for phone could be less. Thanks

adamwathan commented 8 years ago

Hey Luiz! You can add any classes you like using the ->addClass() method. I don't think Bootstrap provides width classes out of the box that you could apply to a form element, but you could define a few of your own helper classes, like this sort of thing:

// These widths are just made up, of course you'd have to figure out something that works for your app
.form-control-short { max-width: 10em; }
.form-control-medium { max-width: 15em; }

...and then add them to your BootForms elements like this:

{!! BootForm::text('Phone', 'phone')->addClass('form-control-short') !!}

Give something like that a go and if it solves your problem, please close the issue :+1: If not, let me know how else I can help and I'll try my best! Thanks.

larbous commented 8 years ago

Thanks. I'm going to do this.