Class: Polaris::OptionList::OptionComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/option_list/option_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**system_arguments) ⇒ OptionComponent

Returns a new instance of OptionComponent.



2
3
4
# File 'app/components/polaris/option_list/option_component.rb', line 2

def initialize(**system_arguments)
  @system_arguments = system_arguments
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
# File 'app/components/polaris/option_list/option_component.rb', line 17

def call
  render(Polaris::BaseComponent.new(**system_arguments)) do
    tag.label(class: "Polaris-OptionList-Option__Label") do
      content
    end
  end
end

#system_argumentsObject



6
7
8
9
10
11
12
13
14
15
# File 'app/components/polaris/option_list/option_component.rb', line 6

def system_arguments
  @system_arguments.tap do |opts|
    opts[:tag] = "li"
    opts[:tabindex] = "-1"
    opts[:classes] = class_names(
      @system_arguments[:classes],
      "Polaris-OptionList-Option"
    )
  end
end