Class: Heroicons::ViewComponent::Icon

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
lib/heroicons/view_component/icon.rb

Constant Summary collapse

VARIANTS =
["outline", "solid"].freeze
SIZES =
["16", "20", "24"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(name:, variant: "outline", size: "24", **html_options) ⇒ Icon

Returns a new instance of Icon.



12
13
14
15
16
17
18
19
20
21
# File 'lib/heroicons/view_component/icon.rb', line 12

def initialize(name:, variant: "outline", size: "24", **html_options)
  super()
  @name = name.to_s
  @variant = variant.to_s
  @size = size&.to_s
  @html_options = html_options

  validate_variant!
  validate_size!
end

Instance Method Details

#callObject



23
24
25
# File 'lib/heroicons/view_component/icon.rb', line 23

def call
  svg_content.html_safe
end