Module: LightningUiKit::Labelable
- Included in:
- CheckboxComponent, ComboboxComponent, DropzoneComponent, FileInputComponent, InputComponent, RadioGroupComponent, SelectComponent, SwitchComponent, TextareaComponent
- Defined in:
- app/components/lightning_ui_kit/labelable.rb
Instance Method Summary collapse
-
#effective_label ⇒ Object
Returns the effective label text.
-
#render_label? ⇒ Boolean
Returns true if a label should be rendered.
Instance Method Details
#effective_label ⇒ Object
Returns the effective label text.
-
If @label is explicitly false, returns nil (no label)
-
If @label is a string, returns that string
-
If @label is nil (not provided), generates a label from @name
7 8 9 10 11 |
# File 'app/components/lightning_ui_kit/labelable.rb', line 7 def effective_label return nil if @label == false @label.presence || humanized_name end |
#render_label? ⇒ Boolean
Returns true if a label should be rendered
14 15 16 |
# File 'app/components/lightning_ui_kit/labelable.rb', line 14 def render_label? @label != false end |