Class: WrapperComponent

Inherits:
Component show all
Defined in:
app/components/wrapper_component.rb

Overview

Wrapper — a plain <div> with optional id/class.

Usage:

Wrapper(id: "main") { text "content" }
Wrapper(html_class: "scrollable") { text "content" }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



12
13
14
15
16
# File 'app/components/wrapper_component.rb', line 12

def to_s
  opts = {}
  opts[:class] = html_class if html_class
  tag.div(**merge_html_options(**opts)) { @content }
end