Class: UI::MenubarRadioGroupComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
MenubarRadioGroupBehavior
Defined in:
app/view_components/ui/menubar_radio_group_component.rb

Overview

RadioGroupComponent - ViewComponent implementation

Container for radio items.

Examples:

Basic usage

render UI::RadioGroupComponent.new do
  render UI::RadioItemComponent.new(value: "light") { "Light" }
  render UI::RadioItemComponent.new(value: "dark") { "Dark" }
end

Instance Method Summary collapse

Methods included from MenubarRadioGroupBehavior

#menubar_radio_group_classes, #menubar_radio_group_data_attributes, #menubar_radio_group_html_attributes

Constructor Details

#initialize(value: nil, classes: "", **attributes) ⇒ MenubarRadioGroupComponent



15
16
17
18
19
# File 'app/view_components/ui/menubar_radio_group_component.rb', line 15

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

Instance Method Details

#callObject



21
22
23
24
25
# File 'app/view_components/ui/menubar_radio_group_component.rb', line 21

def call
   :div, **menubar_radio_group_html_attributes.deep_merge(@attributes) do
    content
  end
end