Class: RubyUIAdmin::UI::Icon

Inherits:
Base
  • Object
show all
Defined in:
app/components/ruby_ui_admin/ui/icon.rb

Overview

Inline Lucide icons (lucide.dev, ISC license) — vendored as SVG paths so the gem needs no icon dependency. Add entries to render_paths as needed.

render RubyUIAdmin::UI::Icon.new(:eye)
render RubyUIAdmin::UI::Icon.new(:trash, class: "size-5")

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(name, **attrs) ⇒ Icon

Returns a new instance of Icon.



11
12
13
14
# File 'app/components/ruby_ui_admin/ui/icon.rb', line 11

def initialize(name, **attrs)
  @name = name.to_sym
  super(**attrs)
end

Instance Method Details

#view_templateObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/ruby_ui_admin/ui/icon.rb', line 16

def view_template
  svg(
    xmlns: "http://www.w3.org/2000/svg",
    viewbox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    stroke_width: "2",
    stroke_linecap: "round",
    stroke_linejoin: "round",
    **attrs
  ) { |s| render_paths(s) }
end