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 dropdown buttons #192

Closed
wants to merge 14 commits into from
Closed

Added dropdown buttons #192

wants to merge 14 commits into from

Conversation

kasperp
Copy link
Contributor

@kasperp kasperp commented Sep 11, 2011

I had another go at adding dropdown menu support to buttons, based on the dropdown introduced in 1.2.0. I went back and forth weather to color the menu based on the colors of the buttons, but decided to do so.

They now look this this:

Primary

primary

Default

default

Info

info

Success

success

Danger

danger

@tdm00
Copy link

tdm00 commented Sep 13, 2011

wow, very nice, good work kasperp!

@luxuryluke
Copy link

Very cool!
Again, these colors for "success", "alert", et al are set in a var, or…? I'll have to look for them…

@kasperp
Copy link
Contributor Author

kasperp commented Sep 13, 2011

@luxuryluke the colors for the buttons are defined in preboot.less (however this seems to change in the 1.3). I made a .menu-color mixin in patterns.less, which take a button color and creates the styles that gives the menus their colors.

I put the .menu-color mixin in patterns.less as I wanted to keep my change as 'local' as possible and not pollute to many files.

@dyve
Copy link

dyve commented Sep 15, 2011

nice

@jimtreadway
Copy link

These are great but don't drop down buttons typically work like normal buttons, and the menu is only shown when you click on the arrow part?

@kasperp
Copy link
Contributor Author

kasperp commented Sep 17, 2011

@jimtreadway I believe there is a distinction between a split button and a dropdown button (also called menu button), and the distinction is what you pointed out. The split button has two parts; a button part and a menu part, the menu is then displayed when the arrow is clicked. The dropdown/menu button only has one part which displays a menu clicked.

However these types of controls are called different things in different frameworks.

In MS they are called splitbuttons and menubuttons
http://msdn.microsoft.com/en-us/library/aa511453.aspx#patterns

In Dojo they are called combobutton and dropdownbutton
http://dojotoolkit.org/reference-guide/dijit/form/ComboButton.html#dijit-form-combobutton
http://dojotoolkit.org/reference-guide/dijit/form/DropDownButton.html#dijit-form-dropdownbutton

I'm sure they are called different things in other frameworks. I don't really care what they are called, in my first attempt I called them for split buttons #131 which I realize was wroing.

Anyway my intention was to provide a button with a menu, like you see in e.g. gmail. This is what I need for the project I'm currently working on. However a split button would also be a great addition to the framework.

@jimtreadway
Copy link

Yes, the Microsoft example (where the above are called "menu buttons") is what I was thinking of, sorry.

Both "split" and "menu" be great additions, however, regardless of the terminology.

So +1 here if it helps. ;)

@mdo mdo closed this Sep 18, 2011
@mdo mdo reopened this Sep 18, 2011
@ItalyPaleAle
Copy link

+1 from me too. Very good addition!

@colinbm
Copy link

colinbm commented Sep 20, 2011

To my eye, the arrow is too close to the text, and too far from the edge. Shouldn't this be more central to the space?
(I am not a designer, so happy to be told I'm wrong)

Otherwise looks great!

@dyve
Copy link

dyve commented Sep 20, 2011

Agree w/ colinbm about the distance text - arrow

@kasperp
Copy link
Contributor Author

kasperp commented Sep 20, 2011

@colinbm I agree there - it could use a little more spacing between the text and the arrow.

@AlainPilon
Copy link

Careful. If the distance is too big, they will look like split buttons. The current design makes it clear that the arrow is associated with the text, they form a single thing, which is the original goal of the button. So I would keep them as it is.

@colinbm
Copy link

colinbm commented Sep 20, 2011

To me the line (that isn't present here) would indicate split buttons, though I realise that would only be apparent once/if that's implemented, and where there were both on a page.

Looking at it again though, if you see the arrow as being part of the text, rather than part of the button, then it begins to look right. (which is your point)

@ekdevdes
Copy link

Would love for you to fork 1.3 and add dropdown button support to it.

@dator-zz
Copy link

+1 for this ! Great work !

@chamerling
Copy link

+1

@JeanMertz
Copy link

Very nice indeed, I hope this gets pulled in soon.

@kbond
Copy link

kbond commented Sep 23, 2011

This is great! +1

Found an outline issue in firefox 6:

twitter bootstrap dropdown button outline issue

@ekdevdes
Copy link

@markdotto can I use this in conjunction with the new 1.3 version of the twitter bootstrap?

@kasperp
Copy link
Contributor Author

kasperp commented Sep 25, 2011

@kbond yes I see that, does anybody have an idea for a fix for that outline issue?

@nijikokun
Copy link

@thomaschaaf
Copy link

I like the way #192 (comment) looks a lot more than the latest.

@sebastianhoitz
Copy link

@kasperp Ok. But there is no Split button designed yet, right? I think it would be pretty easy to base this on your Dropdown button. I'll see what I can do :)

@kasperp
Copy link
Contributor Author

kasperp commented Oct 15, 2011

@sebastianhoitz right there is no split button yet.

@grandfatha
Copy link

Would love to use that right now, any plans when this will be merged/released?

@kasperp
Copy link
Contributor Author

kasperp commented Oct 20, 2011

@granfatha issue #438 (which is kind of a duplicate) has been marked for release v2.0.0, I'm not sure that this is an indication of when this will be pulled. I'm not even sure that it will be pulled but fell free to clone my branch. I'll keep it alive and try to keep it up to date.

@grandfatha
Copy link

Thanks, will do that!

@mdo
Copy link
Member

mdo commented Oct 21, 2011

Just took a fresh look at this... still thinking there is too much code in there. At a high level, here's how I would approach adding dropdowns to the buttons:

  • Try not to add anything else to the .btn styles, and don't introduce another class there like you have to date
  • That said, the only thing you need for the .btn styles is to add .active to the :active styles (so they maintain the depressed state on click)
  • Yes, you will need to add the dropdown arrow in there, but I'd recommend doing that with an empty tag and not :after. :after isn't supported in IE7-8.
  • On the markup side, you do need the div for positioning, so good call there. Do drop the "div" in the selector though.

Think that's everything. Let me know what you think. Oh, and compare this against the dev branch so you're as close to 1.4's upcoming release as possible. Would love to make this part of the release.

@grandfatha
Copy link

Thank you for your amazing work on Bootstrap.

@kevsmt
Copy link

kevsmt commented Oct 21, 2011

When will v2.0 be release? i though it'll jump from 1.3 to 2.0.. that would be nice..

@kasperp
Copy link
Contributor Author

kasperp commented Oct 21, 2011

@markdotto with regards to the dropdown arrow, I have take the same approach as in the existing dropdowns. Not using :after would in my opinion lead to more code as I no longer would be able to use the exiting styles for the dropdown arrow (the .dropdown-toggle:after), unless you also think that these should be changed.

@kasperp
Copy link
Contributor Author

kasperp commented Oct 21, 2011

@markdotto I had a go at implementing your refactoring suggestions. I have tried to incorporate dropdown buttons styles into the existing dropdown styles. I have removed any trace (I hope) from the btn styles. I haven't changed the :after styles for the arrow, as I think that this should work the same way as the existing dropdowns. Let me know what you think.

I also merged with the 1.4-wip branch

@mdo
Copy link
Member

mdo commented Oct 23, 2011

Double check your merge—looks like the pull request got polluted with a bunch of the commits we made outside your code.

Edit: Ahh, I realize what happened. You merged with 1.4-wip, not the dev branch. Sorry for the confusion, I didn't realize 1.4-wip made it up to GitHub. Removing it now.

@kasperp
Copy link
Contributor Author

kasperp commented Oct 23, 2011

@markdotto I guess I misunderstood you then, I thought you wanted me to merge with the 1.4 branch. Do you want me to revert the merge? Or make another pull request to another branch?

@mdo
Copy link
Member

mdo commented Oct 23, 2011

We're developing 1.4 in the dev branch, which we'll be using for each minor point release. I mentioned using "the dev branch" in my previous comment, but alluded to 1.4. That, coupled with an old 1.4-wip branch, led to the confusion. Sorry for that.

I think it'd be best to make a clean pull request to the dev branch and take it from there.

Sound reasonable?

@kasperp
Copy link
Contributor Author

kasperp commented Oct 23, 2011

Yes very reasonable, this pull request is starting to show its age ;-).

@kasperp
Copy link
Contributor Author

kasperp commented Oct 23, 2011

Moved pull request to #467

@kasperp kasperp closed this Oct 23, 2011
@juarezpaf
Copy link

Really great job @kasperp I did implement it in my code, but your version is so much better. Hope to change may code when the next release come!

@santiquiss
Copy link

I made a slightly different version of this, and added a few features that I needed for my app. My version has nested dropdowns, icons, selected menus and intelligent positioning so it doesn't appear off screen :). I also added split buttons so you can have a main action on the button and a dropdown on the arrow, and as a by-product I created grouped buttons, to group related actions in a toolbar for example. Here are a few captures, hope it gives you some inspiration. Cheers from Argentina! :)
Nested dropdown
Grouped dropdown
Split dropdown

@grandfatha
Copy link

Oh snap! Begun the dropdown-btn war has.

@kevsmt
Copy link

kevsmt commented Oct 25, 2011

I think there will be no war w/ dropdown btn w/ submenus because markotto said "It's not a great paradigm to begin with and piling on other levels never works well for users." #424 (comment)

@santiquiss
Copy link

I agree, multiple levels are not a very good experience for users, I discourage the use of them, but I needed it for retro compatibility and I made them just like Mac OS native dropdowns.

@grandfatha
Copy link

Most of the time they are a bad choice. But when you have a hierarchy of things and you want the user to select one element, you sometimes have no clear alternative.

@kevsmt
Copy link

kevsmt commented Oct 25, 2011

I actually like multiple dropdown items, but i guess ill have to make my own because some really fits it by design. Its nice to have it and need it when you dont have it. just saying.

@kasperp
Copy link
Contributor Author

kasperp commented Oct 25, 2011

@santiquiss those look very nice. I especially like the split buttons, can't wait for you make a pull request with those :).

I believe that the button groups are already a part of bootstrap, check this pull request #308.

phaseOne pushed a commit to phaseOne/bootstrap that referenced this pull request Apr 22, 2014
@twbs twbs locked and limited conversation to collaborators Jun 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.