Class: PhlexKit::ToastCancel
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ToastCancel
- Defined in:
- app/components/phlex_kit/toast/toast_cancel.rb
Overview
Subtle dismiss button in a toast (the "Cancel" counterpart to ToastAction). Dismisses via the phlex-kit--toast controller. See toast_region.rb.
Instance Method Summary collapse
-
#initialize(label:, **attrs) ⇒ ToastCancel
constructor
A new instance of ToastCancel.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(label:, **attrs) ⇒ ToastCancel
Returns a new instance of ToastCancel.
5 6 7 8 |
# File 'app/components/phlex_kit/toast/toast_cancel.rb', line 5 def initialize(label:, **attrs) @label = label @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/components/phlex_kit/toast/toast_cancel.rb', line 10 def view_template (**mix({ type: :button, class: "pk-toast-cancel", data: { slot: "cancel", action: "click->phlex-kit--toast#dismiss" } }, @attrs)) { @label } end |