Module: Ariadne::Form::LabelHelper
- Included in:
- BaseComponent, BaseInputComponent
- Defined in:
- app/components/ariadne/form/label_helper.rb
Constant Summary collapse
- BASE_LABEL_STYLES =
every label is basically the same, right?
[ "ariadne:text-sm", "ariadne:font-medium", "ariadne:leading-none", "ariadne:peer-disabled:cursor-not-allowed", "ariadne:peer-disabled:opacity-70", "ariadne:block", "ariadne:mb-2", "ariadne:text-sm", "ariadne:font-medium", "ariadne:text-gray-900", "ariadne-dark:text-white", ]
Instance Method Summary collapse
Instance Method Details
#label_styles ⇒ Object
30 31 32 33 |
# File 'app/components/ariadne/form/label_helper.rb', line 30 def label_styles label_classes = sr_label.present? ? "sr-only" : "" merge_tailwind_classes([style(:label), label_classes].join(" ")) end |
#render_label ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/components/ariadne/form/label_helper.rb', line 21 def render_label return unless label.present? content_tag(:div, class: "ariadne:flex ariadne:items-center ariadne:gap-1") do concat(content_tag(:label, label, class: label_styles, **label_arguments)) concat(content_tag(:span, "*", "aria-hidden": true)) if required? end end |