Skip to Content
Closure: The Definitive Guide
book

Closure: The Definitive Guide

by Michael Bolin
September 2010
Intermediate to advanced
592 pages
18h 30m
English
O'Reilly Media, Inc.
Content preview from Closure: The Definitive Guide

Chapter 8. User Interface Components

The set of user interface (UI) components provided by the browser as HTML 4 elements is limited to <input>, <select>, <textarea>, and <button>. Generally, building a custom component requires the creative use of HTML and CSS to produce something that looks like what you want. Remember, HTML was originally designed for formatting text, not for building UI widgets, so getting it to do your bidding is often a challenge.

Even once you get the HTML and CSS right, there is still the matter of adding JavaScript so that it responds appropriately to user input events and testing it to make sure that it works consistently across web browsers. This is a time-consuming process, so it helps to leverage existing UI components. Fortunately, the Closure Library contains many UI components, the implementation of which exhibit the design principles of inheritance and event management in Closure described in Chapters 5 and 6, respectively.

The goog/ui folder in the Closure Library contains over 100 JavaScript files, so this chapter will not attempt to explain all of them. (A list of the most commonly used UI widgets appears in Table 8-8.) Instead, the focus will be on explaining the design behind the components, providing examples of how to use some of the existing components, and then demonstrating how to implement your own components. Together, these sections will provide the tools you need to master the goog.ui package.

Due to the length of this chapter, you may ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Etudes for ClojureScript

Etudes for ClojureScript

J. David Eisenberg
The Hidden Cost of AI-Assisted Creativity

The Hidden Cost of AI-Assisted Creativity

Léonard Boussioux, Anil Doshi, Oliver Hauser, Kartik Hosanagar

Publisher Resources

ISBN: 9781449381882Errata Page