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
-
#additional_classes ⇒ Object
readonly
Returns the value of attribute additional_classes.
-
#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:, style: :default, dismissible: true, class: [], **options) ⇒ Toast
constructor
A new instance of Toast.
Constructor Details
#initialize(message:, style: :default, dismissible: true, class: [], **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:, style: :default, dismissible: true, class: [], **) = @style = style @dismissible = dismissible @additional_classes = Array(binding.local_variable_get(:class)) || [] = end |
Instance Attribute Details
#additional_classes ⇒ Object (readonly)
Returns the value of attribute additional_classes.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def additional_classes @additional_classes end |
#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 end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'app/components/flowbite/toast.rb', line 20 def 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-gray-500", "bg-white", "rounded-lg", "shadow-sm", "dark:text-gray-400", "dark:bg-gray-800"] end |
Instance Method Details
#container_classes ⇒ Object
30 31 32 |
# File 'app/components/flowbite/toast.rb', line 30 def container_classes self.class.classes + additional_classes end |