Class: RubyUI::DialogContent

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/dialog/dialog_content.rb

Constant Summary collapse

SIZES =
{
  xs: "max-w-sm",
  sm: "max-w-md",
  md: "max-w-lg",
  lg: "max-w-2xl",
  xl: "max-w-4xl",
  full: "max-w-full"
}

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(size: :md, **attrs) ⇒ DialogContent

Returns a new instance of DialogContent.



14
15
16
17
# File 'lib/ruby_ui/dialog/dialog_content.rb', line 14

def initialize(size: :md, **attrs)
  @size = size
  super(**attrs)
end

Instance Method Details

#view_templateObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ruby_ui/dialog/dialog_content.rb', line 19

def view_template
  template(data: {ruby_ui__dialog_target: "content"}) do
    div(data_controller: "ruby-ui--dialog") do
      backdrop
      div(**attrs) do
        yield
        close_button
      end
    end
  end
end