Class: Trellis::CoreComponents::Label

Inherits:
Trellis::Component show all
Defined in:
lib/trellis/component_library/core_components.rb

Overview

Returns a label tag tailored for labelling an input field for a specified attribute (identified by method) on an object assigned to the template (identified by object). The text of label will default to the attribute name unless you specify it explicitly. Additional options on the label tag can be passed as a hash with options. These options will be tagged onto the HTML as an HTML element attribute as in the example shown.

Examples

label(:post, :title)
#=> <label for="post_title">Title</label>

label(:post, :title, "A short title")
#=> <label for="post_title">A short title</label>

label(:post, :title, "A short title", :class => "title_label")
#=> <label for="post_title" class="title_label">A short title</label>

Instance Attribute Summary

Attributes inherited from Trellis::Component

#logger, #page

Method Summary

Methods inherited from Trellis::Component

add_class_scripts_to_page, add_class_styles_to_page, add_document_modifications_to_page, add_script_links_to_page, add_scripts_to_page, add_style_links_to_page, add_styles_to_page, contained_in, depends_on, field, get_component, inherited, #initialize, is_stateful, #load_component_session_information, page_contribution, register_with_tag_context, render, #save_component_session_information, tag_name

Constructor Details

This class inherits a constructor from Trellis::Component