Class: Railsboot::Dropdown::HeaderComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/dropdown/header_component.rb

Overview

ViewComponent: renders the header block.

Instance Method Summary collapse

Constructor Details

#initialize(text: "", **html_attributes) ⇒ HeaderComponent

Returns a new instance of HeaderComponent.

Parameters:

  • text (String) (defaults to: "")

    the text option

  • html_attributes (Hash)

    additional HTML attributes applied to the rendered element

Options Hash (**html_attributes):

  • :class (String)

    additional CSS classes, merged with the component's own classes



7
8
9
10
11
12
13
14
15
# File 'app/components/railsboot/dropdown/header_component.rb', line 7

def initialize(text: "", **html_attributes)
  @text = text
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "dropdown-header",
    html_attributes.delete(:class)
  )
end