YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
This example demonstrates how to create a Menu Button whose text label has a
fixed width. The behavior of this widget is similar to an HTML
<select>
element in that its label hides any overflow
when updated to represent the selected menu item.
Begin by creating a Button instance of type "menu," wrapping its text label
in an <em>
element.
Style the <em>
element so that it has a fixed width of
10em, and prevent the characters from exceeding this width by setting its
"overflow" property to "hidden."
Finally, add a selectedMenuItemChange
event handler to the
Button that will update its label when any item in the Menu is clicked.
Note: Logging and debugging is currently turned off for this example.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.