views:

58

answers:

1

I need a visual element on my web page to resemble a button, with an optional dropdown element on the right end. Clicking the main button will execute some default action, while clicking (or hovering) over the down arrow on the right end of the button will cause a dropdown menu to appear with variations on the action, and clicking on one of those will invoke various javascript methods.

|-----------------------------|
| Take Action            | \/ |
|-----------------------------|

|-----------------------------|
| Take Action            | \/ |
|-----------------------------|
       | variant 1            |
       | variant 2            |
       | variant 3            |
       |----------------------|

Before I go write this myself, has anyone else seen something like this as an open source bit of code I can reuse?

+1  A: 

Yes, I believe they're referred to as Split Buttons. YUI has it since 2.0 and implements it just as you describe (I've seen some other implementations show the menu on click anywhere on the button, which is not what you want).

Crescent Fresh
Eureka! That's exactly it! Thank you!
Andrew Arnott