Class: NitroKit::Label
- Defined in:
- app/components/nitro_kit/label.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Component
Instance Method Summary collapse
-
#initialize(text = nil, **attrs) ⇒ Label
constructor
A new instance of Label.
- #view_template(&block) ⇒ Object
Methods inherited from Component
Constructor Details
#initialize(text = nil, **attrs) ⇒ Label
Returns a new instance of Label.
5 6 7 8 9 10 11 12 13 |
# File 'app/components/nitro_kit/label.rb', line 5 def initialize(text = nil, **attrs) @text = text super( attrs, class: "text-sm font-medium select-none", data: { slot: "label" } ) end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
15 16 17 |
# File 'app/components/nitro_kit/label.rb', line 15 def text @text end |
Instance Method Details
#view_template(&block) ⇒ Object
17 18 19 20 21 |
# File 'app/components/nitro_kit/label.rb', line 17 def view_template(&block) label(**attrs) do text_or_block(text, &block) end end |