Class: RUI::Buttons::Base
- Defined in:
- lib/rui/buttons/base.rb
Direct Known Subclasses
Constant Summary collapse
- STYLE =
Style string public for use in forms
"inline-block px-2 py-1 hover:cursor-pointer rounded-md transition duration-200 ease-in-out".freeze
Instance Method Summary collapse
-
#initialize(icon: nil, **attrs) ⇒ Base
constructor
A new instance of Base.
- #view_template ⇒ Object
Constructor Details
#initialize(icon: nil, **attrs) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'lib/rui/buttons/base.rb', line 4 def initialize(icon: nil, **attrs) @icon = icon @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rui/buttons/base.rb', line 12 def view_template (class: classes, **@attrs) do div(class: "flex flex-row items-center gap-2") do if @icon div(class: "size-4 my-1") do render RUI::Icon.new(@icon) end end span(class: "text-nowrap") { yield } if block_given? end end end |