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

Added support for multiple .form-controls per .input-group #12732

Closed
brenjt opened this issue Feb 13, 2014 · 7 comments
Closed

Added support for multiple .form-controls per .input-group #12732

brenjt opened this issue Feb 13, 2014 · 7 comments

Comments

@brenjt
Copy link

brenjt commented Feb 13, 2014

This will add support for form-controls to be inline and grouped together. I propose we make it official. It may need further adjustments.

.input-group-field {
    display: table-cell;
    vertical-align: middle;
    border-radius:4px;
    min-width:1%;
    white-space: nowrap;
}
.input-group-field .form-control {
    border-radius: inherit !important;
}
.input-group-field:not(:first-child):not(:last-child) {
    border-radius:0;
}
.input-group-field:not(:first-child):not(:last-child) .form-control {
    border-left-width: 0;
    border-right-width: 0;
}
.input-group-field:last-child {
    border-top-left-radius:0;
    border-bottom-left-radius:0;
}

Example HTML:

    <div class='input-group'>
        <span class='input-group-addon'>Add On</span>
        <input type='text' class='form-control' placeholder="Field 1" />
        <div class='input-group-field'>
            <input type='text' class='form-control' placeholder="Field 2" />
        </div>
        <div class='input-group-field'>
            <input type='text' class='form-control' placeholder="Field 3" />
        </div>
    </div>

Previews: http://jsfiddle.net/523Vc/, http://jsfiddle.net/523Vc/1/

@cvrebert cvrebert added this to the v3.2.0 milestone Feb 13, 2014
@cvrebert
Copy link
Collaborator

X-Ref: #12109.

@mdo
Copy link
Member

mdo commented Feb 14, 2014

Thanks, but we won't be going this route. The CSS for that is rather gnarly and I don't see a common enough need for this.

@mdo mdo closed this as completed Feb 14, 2014
@mdo mdo removed this from the v3.2.0 milestone Feb 14, 2014
@brenjt
Copy link
Author

brenjt commented Feb 14, 2014

The CSS is actually the same CSS used for the .input-group-btn and .input-group-addon with minor adjustments.

Here is a perfectly useful use case for this: http://jsfiddle.net/523Vc/1/

@ghost
Copy link

ghost commented Feb 14, 2014

+1

@Darunada
Copy link

I pretty much hacked this in anyways to create a single row with city,state, zip. +1

@krugerdavid
Copy link

@brenjt if you don't mind, I will use your code for adding multiple inputs, a basic case to use are checkout fields, primary on mobile :) +1

@Fredar
Copy link

Fredar commented Mar 23, 2015

@brenjt Thanks for the inspiration. This is a 3rd time I needed that and finally got it done. +1

@twbs twbs locked and limited conversation to collaborators Apr 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants