Module: Shoelace::TagHelper

Defined in:
app/helpers/shoelace/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#sl_avatar_tag(source, **attrs, &block) ⇒ Object



23
24
25
# File 'app/helpers/shoelace/tag_helper.rb', line 23

def sl_avatar_tag(source, **attrs, &block)
  tag.sl_avatar(image: source, **attrs, &block)
end

#sl_button_tag(**attrs, &block) ⇒ Object

Creates a generic <sl-button> element.



6
7
8
# File 'app/helpers/shoelace/tag_helper.rb', line 6

def sl_button_tag(**attrs, &block)
  ("sl-button", **attrs, &block)
end

#sl_button_to(body, href = nil, **attrs, &block) ⇒ Object

Creates an <sl-button> tag with the href value as the caption.



11
12
13
14
15
16
17
# File 'app/helpers/shoelace/tag_helper.rb', line 11

def sl_button_to(body, href = nil, **attrs, &block)
  if block_given?
    sl_button_tag(href: body, **(href || {}), **attrs, &block)
  else
    sl_button_tag(href: href, **attrs) { body }
  end
end

#sl_icon_tag(name, **attrs) ⇒ Object



19
20
21
# File 'app/helpers/shoelace/tag_helper.rb', line 19

def sl_icon_tag(name, **attrs)
  tag.sl_icon(name: name, **attrs)
end