YUI 3.x Home -

Yahoo! User Interface Library (YUI): Index of Library Examples

Note: This is YUI 3.x. Looking for YUI 2.x?

Official YUI Examples

The YUI Library 3.x ships with a series of 101 examples that illustrate the implementation of its components. The examples can be starting points for your exploration, code snippets to jump-start your own programming, or simply inspiration as to how various interaction patterns can be enabled in the web browser via YUI.

This page allow you to explore these examples component-by-component; on this page you'll find the full index of library examples with the link and short description of each.

YUI 3 Core

Event

Simple DOM EventsUse the Event Utility to attach simple DOM event handlers.
Using 'available', 'contentready', and 'domready'Event Utility gives you control over when you execute your scripts. In addition to the window's load event, Event Utility lets you know when an element is available, when its children are available, and when the page's full DOM is available.
Using Custom EventsUse the Event Utility to create Custom Events that are bubbleable, preventable, cancelable and much more.
Using the 'focus' and 'blur' custom eventsUsing the ClassNameManager Utility and the Event Utility's focus and blur custom events to skin checkboxes.

Node

Node BasicsUsing selectors and property accessors with Node.
DOM MethodsUsing DOM methods.
Node EventsUsing events with Node instances.
NodeListNodeList provides Node functionality for multiple nodes.
Delegating Node EventsUsing a single event listener to handle events on multiple nodes.
Measuring the Window and DocumentThis example demonstrates how to measure the window and document.
Node PositioningThis example demonstrates how to position an element in page coordinates.
Node StylingThis example demonstrates how to set styles and get style information.

The YUI Global Object

YUI CoreYUI Core
Load All ModulesLoad All Modules
Multiple InstancesWorking with multiple YUI instances.
YUI 2.x and 3.xWorking with YUI 2.x and 3.x.
YUI Loader - Dynamically Adding YUI and External ModulesOn-demand loading of YUI and non-YUI assets
Create Class Hierarchies with extendCreate class hierarchies with extend
Compose Classes of Objects with augmentCreating a composition-based class structure using augment
Add Behaviors to Objects with mixAdd behaviors to objects or static classes with mix
Combine Data Sets with mergeCombine data sets and create shallow copies of objects with merge
Check Data Types with LangCheck data types with the Lang Utilities
Browser Detection with UAGet information about the current user agent with UA

YUI 3 Utilities

Animation

Basic AnimationCreating and using a simple animation.
Animation EasingThe Animation Utility allows you to implement 'easing effects' — for example, when an animation gradually slows down as it nears completion, that's an easing effect known as 'ease-in'. This example shows you how to use easing effects with your animations.
Animating ColorsColor animations can be effective indicators of state during the lifespan of a dynamic page. This example shows you how to animate color attributes of an element.
Alternating IterationsThe direction attribute can be used to reverse the animation on alternate iterations.
Animating XY PositionThis example shows you how to animate the xy coordinates of an element.
Animating Along a Curved PathThis example demonstrates animating an element along a curved path using bezier control points.
Animated ScrollingThis example shows how to animate the scrolling of an element.
Reversing an AnimationThe reverse attribute allows you to change the run direction of an animation.
Using the End EventThis example demonstrates how to use the end event.
Chaining Animations Using the end EventAnimations can be chained (set to fire sequentially) using Animation's end event.

Cookie

Simple Cookie ExampleDemonstrates basic usage of the Cookie utility for reading and writing cookies.
Advanced Cookie ExampleDemonstrates using the Cookie utility to get, set and remove cookies.
Subcookie ExampleDemonstrates using the Cookie utility to get and set subcookies.

Drag & Drop

Simple DragThis example shows a simple drag interaction that doesn't require a drop interaction.
Drag Node PluginThis example shows using the Drag Node Plugin.
Proxy DragThis example shows a simple proxy drag interaction that doesn't require a drop interaction.
Drag Constrained to a RegionThis example shows how to constrain a draggable Node to another Nodes region.
Interaction GroupsUsing interaction groups, this example demonstrates how to tie into the Drag & Drop Utility's interesting moments to provide visual affordances for the current drag operation.
Using the Drag ShimThis example shows the use of the drag shim when dragging nodes over other troublesome nodes.
List reorder w/BubblingThis example shows how to make a sortable list using Custom Event Bubbling.
Portal Style ExamplePortal style example using Drag & Drop Event Bubbling and Animation.
Animated Drop TargetsThis example will show you how to make an animated node a Drop target.
Drop Based CodingThis example shows how to use the Drop Target events to code your application.

Get

Getting a Script Node with JSON DataThis example illustrates the simple use case in which the Get Utility is used to retrieve JSON data from a web service.

IO

GET TransactionExplores the use of HTTP GET to request data from the server, and handling the transaction lifecycle using events.
POST TransactionExplores the use of HTTP POST to send data to the server and retrieve the server's response.
XML Transaction — Retrieving a Yahoo! Weather RSS (XML) Feed via a Server-Side ProxyDemonstrates how to retrieve XML data from a web service and make use of that information within the page.
Cross-Domain JSON Transaction — Retrieving a News Feed from Yahoo! PipesFetch a cross-domain, JSON-formatted RSS news feed directly from Yahoo! Pipes.

JSON

JSON with Y.ioUse JSON to parse data received from Y.io calls
Rebuilding class instances from JSON dataUsing the replacer and reviver parameters to reconstitute object instances
Adding new object members during parsingUsing a currency conversion calculation to add a new price member to a JSON response

Queue

Building a UI with QueueUsing Queue to incrementally construct an application interface

YUI 3 Component Infrastructure

Attribute

Basic ConfigurationUse the Attribute API to define, set and get attribute values.
Change EventsHow to listen for changes in attribute values.
Custom Getters, Setters and ValidatorsAdd custom methods to get and set attribute values and provide validation support.
Value Clone ConfigurationSpecify how attributes should be cloned, when returning values through get.
readOnly and writeOnce ConfigurationConfigure attributes to be readOnly or writeOnce.

Plugin

Basic Node PluginHow to build a basic node plugin

Widget

Extending the base widget classShows how to extend the base widget class, to create your own Widgets.
Creating custom widget classesShows how to use Base.build to create custom Widget classes.
Creating a simple Tooltip widgetShows how to extend the Widget class, and add WidgetPosition and WidgetStack to create a Tooltip widget class.

YUI 3 Widgets

Overlay

Basic XY PositioningShows how to instantiate a basic Overlay instance, and use the Overlay's basic XY positioning support.
Extended XY PositioningShows how to use the Overlay's extended XY positioning support, to align the Overlay relative to another element, or the viewport.
Stack SupportShows how to use the Overlay's zindex and shim support when positioning Overlays above other elements on the page.
Standard Module SupportShows how to modify content in the Overlay's header, body and footer sections.
IO PluginShows how to create a simple plugin to retrieve content for the Overlay using the io utility.
Animation PluginShows how to create a simple plugin to animate the Overlay's movement and visibility.

Slider

Basic SlidersThe basics of setting up a horizontal and vertical Slider
Creating a Slider from existing markupCreating a horizontal Slider from existing markup

YUI 3 Developer Tools

Console

Creating a Console for debuggingThe basics of setting up a Console
Filtering log messagesUsing your YUI instance configuration to filter which messages are reported in the Console

Profiler

Simple Profiling ExampleDemonstrates basic usage of the Profiler for profiling functions.
Object Profiling ExampleDemonstrates usage of the Profiler for profiling objects.

YUI Test

Simple Testing ExampleDemonstrates basic usage of YUI Test for setting up and running tests.
Advanced Test OptionsDemonstrates how to use advanced testing features such as defining tests that should fail, tests that should be ignored, and tests that should throw an error.
Array ProcessingDemonstrates how to use the ArrayAssert object to test array data.
Asynchronous TestingDemonstrates basic asynchronous tests.
Asynchronous Event TestingDemonstrates using events with asynchronous tests.

YUI 3 CSS Foundation

CSS Base

Global (Page-Level) ExampleWhen CSS Base is included in a page it provides consistent and basic cross-browser styling for HTML elements.
Contextual ExampleCSS Base applied to a portion of a page based on the location of a class value.

CSS Fonts

Global (Page-Level) ExampleWhen CSS Fonts is included in a page, it applies a baseline font treatment to all HTML elements. This baseline is Arial at the equivalent of 13px size and 16px line-height.
Contextual ExampleUse the alternate contextual version of YUI Fonts to have precise control over which regions of the page are targeted.
Setting Font SizeDefine all non-baseline sizes in percentages when using YUI Fonts.
Setting Font FamilyWhen using YUI Fonts, set font-family as you would normally.

CSS Grids

Available Page WidthsChoose a preset page width. Choose fluid or fixed widths.
Customize the Page WidthCustomization is easy when you need a specific page width.
Available Preset TemplatesTwo-column page layouts
Nesting GridsUse nesting grids to define sub-regions

CSS Reset

Global (Page-Level) ExampleWhen CSS Reset is included in a page, it removes the browser-provided styling for HTML elements.
Contextual ExampleCSS Reset applied to a portion of a page based on the location of a class value.

YUI 3 Node Plugins

MenuNav Node Plugin

Basic Left NavCreating left navigation using the MenuNav Node Plugin
Basic Top NavCreating top navigation using the MenuNav Node Plugin
Menu Button Top NavCreating menu button navigation using the MenuNav Node Plugin
Split Button Top NavCreating split button navigation using the MenuNav Node Plugin
Left Nav With Submenus With ShadowsAdding shadows to submenus of a left nav using the MenuNav Node Plugin
Left Nav With Submenus With Rounded CornersAdding rounded corners to submenus of a left nav using the MenuNav Node Plugin
Skinning Menus Created Using the MenuNav Node PluginSkining a menu built using the MenuNav Node Plugin to look like the menus on Flickr
Adding Submenus On The FlyBuilding Submenus On The Fly Using the MenuNav Node Plugin with the IO Utility

Copyright © 2008 Yahoo! Inc. All rights reserved.

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