Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I create a 'bootstrap-style checkbox' with bootstrapper? #261

Open
blueset opened this issue Dec 29, 2014 · 1 comment
Open

How do I create a 'bootstrap-style checkbox' with bootstrapper? #261

blueset opened this issue Dec 29, 2014 · 1 comment

Comments

@blueset
Copy link

blueset commented Dec 29, 2014

From Twitter bootstrap 3 documentation, they created a checkbox like this.

 <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">
        <label>
          <input type="checkbox"> Remember me
        </label>
      </div>
    </div>
  </div>

But when I write the code according to the Bootstrapper documentation, like this,

ControlGroup::generate(
    Form::label('control', ' '),
            [
                [
                    'label' => ['remember_me', 'Remember me'],
                    'input' => ['type' => 'checkbox', 'remember_me', 'Remember me']
                ]
            ],
    '',
    4
    )

And it comes out like this

<div class='form-group'>
  <label for="control" class="control-label col-sm-4">
  </label>
  <div class='col-sm-8'>
    <label for="remember" class="control-label">
      Remember me
    </label>
    <input name="first" type="checkbox" value="First" id="first">
    <br />
  </div>
</div>

The generated form looks a little strange and crowded. So is there anyway to prepend the checkbox inside the label?

@PatrickRose
Copy link
Collaborator

We delegate most form html to Laravel. In this instance you could add the
check box to the label. However we don't really have an easy way of doing
the col offsets.

You're probably best not using the control group in this instance - build
it up manually instead.
On 29 Dec 2014 05:44, "Blueset" notifications@github.com wrote:

From Twitter bootstrap 3 documentation, they created a checkbox like this.

Remember me

But when I write the code according to the Bootstrapper documentation,
like this,

ControlGroup::generate( Form::label('control', ' '), [ [ 'label' => ['remember_me', 'Remember me'], 'input' => ['type' => 'checkbox', 'remember_me', 'Remember me'] ] ], '', 4 )->withAttributes(['data-foo' => 'bar'])

And it comes out like this

Remember me

The generated form looks a little strange and crowded. So is there anyway
to prepend the checkbox inside the label?


Reply to this email directly or view it on GitHub
#261.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants