Class: UI::ContextMenuRadioGroup

Inherits:
Phlex::HTML
  • Object
show all
Includes:
ContextMenuRadioGroupBehavior
Defined in:
app/components/ui/context_menu_radio_group.rb

Overview

RadioGroup - Phlex implementation

Container for radio menu items. Uses ContextMenuRadioGroupBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::RadioGroup.new do
  render UI::RadioItem.new(checked: true) { "Option 1" }
  render UI::RadioItem.new { "Option 2" }
end

Instance Method Summary collapse

Methods included from ContextMenuRadioGroupBehavior

#context_menu_radio_group_classes, #context_menu_radio_group_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ ContextMenuRadioGroup

Returns a new instance of ContextMenuRadioGroup.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



18
19
20
21
# File 'app/components/ui/context_menu_radio_group.rb', line 18

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



23
24
25
26
27
# File 'app/components/ui/context_menu_radio_group.rb', line 23

def view_template(&block)
  div(**context_menu_radio_group_html_attributes.merge(@attributes)) do
    yield if block_given?
  end
end