YUI Library Examples: Button Control: Color Picker Button

Button Control: Color Picker Button

This example demonstrates how to render a Color Picker into the Menu of a Split Button.

Begin by creating a Menu instance that will house the ColorPicker instance. Next, instantiate a new Button of type "split," setting its "menu" attribute to the Menu instance.

Once the new Button is created, add a listener for its "option" event that will be used to render its Menu as well as to create a new ColorPicker instance. (Defering the rendering of the Menu until the firing of the "option" event improves the intial load time of the Button instance.)

Lastly, add some styles that customize both the Button's text label and the ColorPicker instance.

Copyright © 2007 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings