Class: PhlexKit::ToastClose
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ToastClose
- Defined in:
- app/components/phlex_kit/toast/toast_close.rb
Overview
The ×-in-the-corner close button, shown when the region has close_button: true (or a spawn asks for one). See toast_region.rb.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ ToastClose
constructor
A new instance of ToastClose.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ ToastClose
Returns a new instance of ToastClose.
5 6 7 |
# File 'app/components/phlex_kit/toast/toast_close.rb', line 5 def initialize(**attrs) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/components/phlex_kit/toast/toast_close.rb', line 9 def view_template (**mix({ type: :button, class: "pk-toast-close", aria: { label: "Close toast" }, data: { slot: "close", action: "click->phlex-kit--toast#dismiss" } }, @attrs)) do render Icon.new(:x, size: 14) span(class: "pk-sr-only") { "Close" } end end |