Class: Flowbite::Toast::CloseButton

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/flowbite/toast/close_button.rb

Overview

Renders the close button of a toast notification.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ CloseButton

Returns a new instance of CloseButton.



19
20
21
# File 'app/components/flowbite/toast/close_button.rb', line 19

def initialize(**options)
  @options = options || {}
end

Class Method Details

.classes ⇒ Object

Styles from https://flowbite.com/docs/components/toast/#default-toast rubocop:disable Layout/LineLength



13
14
15
# File 'app/components/flowbite/toast/close_button.rb', line 13

def classes
  ["ms-auto", "flex", "items-center", "justify-center", "text-body", "hover:text-heading", "bg-transparent", "box-border", "border", "border-transparent", "hover:bg-neutral-secondary-medium", "focus:ring-4", "focus:ring-neutral-tertiary", "font-medium", "leading-5", "rounded", "text-sm", "h-8", "w-8", "focus:outline-none"]
end

Instance Method Details

#button_options ⇒ Object



23
24
25
26
27
28
29
# File 'app/components/flowbite/toast/close_button.rb', line 23

def button_options
  {
    aria: {label: "Close"},
    class: self.class.classes,
    type: "button"
  }.merge(@options)
end