Module: Shoelace::TagHelper
- Defined in:
- app/helpers/shoelace/tag_helper.rb
Instance Method Summary collapse
- #sl_avatar_tag(source, **attrs, &block) ⇒ Object
-
#sl_button_tag(**attrs, &block) ⇒ Object
Creates a generic <sl-button> element.
-
#sl_button_to(body, href = nil, **attrs, &block) ⇒ Object
Creates an <sl-button> tag with the href value as the caption.
- #sl_icon_tag(name, **attrs) ⇒ Object
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 (**attrs, &block) content_tag("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 (body, href = nil, **attrs, &block) if block_given? (href: body, **(href || {}), **attrs, &block) else (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 |