Class: Flowbite::Toast
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Toast
- Defined in:
- app/components/flowbite/toast.rb,
app/components/flowbite/toast/icon.rb
Overview
Renders a toast notification element.
Defined Under Namespace
Classes: Icon
Instance Attribute Summary collapse
-
#dismissible ⇒ Object
readonly
Returns the value of attribute dismissible.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
- #container_classes ⇒ Object
-
#initialize(message:, dismissible: true, style: :default, class: nil, **options) ⇒ Toast
constructor
A new instance of Toast.
Constructor Details
#initialize(message:, dismissible: true, style: :default, class: nil, **options) ⇒ Toast
Returns a new instance of Toast.
22 23 24 25 26 27 28 |
# File 'app/components/flowbite/toast.rb', line 22 def initialize(message:, dismissible: true, style: :default, class: nil, **) @message = @style = style @dismissible = dismissible @class = Array.wrap(binding.local_variable_get(:class)) @options = end |
Instance Attribute Details
#dismissible ⇒ Object (readonly)
Returns the value of attribute dismissible.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def dismissible @dismissible end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def @message end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def @options end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def style @style end |
Class Method Details
.classes ⇒ Object
15 16 17 |
# File 'app/components/flowbite/toast.rb', line 15 def classes ["flex", "items-center", "w-full", "max-w-xs", "p-4", "text-body", "bg-neutral-primary-soft", "rounded-base", "shadow-xs", "border", "border-default"] end |
Instance Method Details
#container_classes ⇒ Object
30 31 32 |
# File 'app/components/flowbite/toast.rb', line 30 def container_classes self.class.classes + @class end |