Class: UI::Empty

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

Overview

Empty - Phlex implementation

Displays empty states in applications with customizable media, titles, descriptions, and actions.

Examples:

Basic usage

render UI::Empty.new do
  render UI::EmptyHeader.new do
    render UI::EmptyTitle.new { "No results found" }
    render UI::EmptyDescription.new { "Try adjusting your search criteria." }
  end
end

Instance Method Summary collapse

Methods included from EmptyBehavior

#empty_classes, #empty_html_attributes

Constructor Details

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

Returns a new instance of Empty.



17
18
19
20
# File 'app/components/ui/empty.rb', line 17

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

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
# File 'app/components/ui/empty.rb', line 22

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