Module: UI::KbdGroupBehavior
- Included in:
- KbdGroup, KbdGroupComponent
- Defined in:
- app/behaviors/ui/kbd_group_behavior.rb
Overview
KbdGroupBehavior
Shared behavior for KbdGroup component across ERB, ViewComponent, and Phlex implementations. Groups multiple keyboard keys together with consistent spacing.
Instance Method Summary collapse
-
#kbd_group_classes ⇒ Object
Returns combined CSS classes for the kbd group element.
-
#kbd_group_html_attributes ⇒ Object
Returns HTML attributes for the kbd group element.
Instance Method Details
#kbd_group_classes ⇒ Object
Returns combined CSS classes for the kbd group element
18 19 20 21 22 23 |
# File 'app/behaviors/ui/kbd_group_behavior.rb', line 18 def kbd_group_classes classes_value = respond_to?(:classes, true) ? classes : @classes base = "inline-flex items-center gap-1" TailwindMerge::Merger.new.merge([base, classes_value].compact.join(" ")) end |
#kbd_group_html_attributes ⇒ Object
Returns HTML attributes for the kbd group element
9 10 11 12 13 14 15 |
# File 'app/behaviors/ui/kbd_group_behavior.rb', line 9 def kbd_group_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { class: kbd_group_classes, "data-slot": "kbd-group" }.merge(attributes_value).compact end |