Class: UI::EmptyContent

Inherits:
Phlex::HTML
  • Object
show all
Includes:
EmptyContentBehavior
Defined in:
app/components/ui/empty_content.rb

Overview

EmptyContent - Phlex implementation

Displays the content of the empty state such as a button, input or a link.

Examples:

render UI::EmptyContent.new do
  render UI::Button.new { "Create Item" }
end

Instance Method Summary collapse

Methods included from EmptyContentBehavior

#empty_content_classes, #empty_content_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ EmptyContent

Returns a new instance of EmptyContent.



14
15
16
17
# File 'app/components/ui/empty_content.rb', line 14

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



19
20
21
# File 'app/components/ui/empty_content.rb', line 19

def view_template(&block)
  div(**empty_content_html_attributes.merge(@attributes), &block)
end