Home

# Class goog.ui.ButtonRenderer

Default renderer for {@link goog.ui.Button}s. Extends the superclass with the following button-specific API methods:

- {@code getValue} - returns the button element's value
- {@code setValue} - updates the button element to reflect its new value
- {@code getTooltip} - returns the button element's tooltip text
- {@code setTooltip} - updates the button element's tooltip text
- {@code setCollapsed} - removes one or both of the button element's borders

For alternate renderers, see {@link goog.ui.NativeButtonRenderer}, {@link goog.ui.CustomButtonRenderer}, and {@link goog.ui.FlatButtonRenderer}.extends goog.ui.ControlRenderer

Instance Method Summary
| `createDom(?goog.ui.Control control) ⇒ ?Element` Returns the control's contents wrapped in a DIV, with the renderer's own CSS class and additional state-specific classes applied to it.
| `decorate(?goog.ui.Control control, ?Element element) ⇒ ?Element` Default implementation of {@code decorate} for {@link goog.ui.Control}s. Initializes the control's ID, content, and state based on the ID of the element, its child nodes, and its CSS classes, respectively. Returns the element.
| `getAriaRole() ⇒ (goog.dom.a11y.Role|null|undefined)` Returns the ARIA role to be applied to buttons.
| `getCssClass() ⇒ string` Returns the CSS class name to be applied to the root element of all components rendered or decorated using this renderer. The class name is expected to uniquely identify the renderer class, i.e. no two renderer classes are expected to share the same CSS class name.
| `getTooltip(?Element element) ⇒ (string|undefined)` Takes a button's root element, and returns its tooltip text.
| `getValue(?Element element) ⇒ (string|undefined)` Takes a button's root element, and returns the value associated with it. No-op in the base class.
| `setCollapsed(?goog.ui.Button button, number sides)` Collapses the border on one or both sides of the button, allowing it to be combined with the adjacent button(s), forming a single UI componenet with multiple targets.
| `setTooltip(?Element element, string tooltip)` Takes a button's root element and a tooltip string, and updates the element with the new tooltip.
| `setValue(?Element element, string value)` Takes a button's root element and a value, and updates the element to reflect the new value. No-op in the base class.
| `updateAriaState(?Element element, ?goog.ui.Component.State state, boolean enable)` Updates the button's ARIA (accessibility) state if the button is being treated as a checkbox.