Class: Flowbite::Link
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Link
- Defined in:
- app/components/flowbite/link.rb
Overview
The link component can be used to set hyperlinks from one page to another or to an external website when clicking on an inline text item, button, or card
Use this component to add default styles to an inline link element.
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href:, class: nil, **options) ⇒ Link
constructor
Initialize the Link component.
Constructor Details
#initialize(href:, class: nil, **options) ⇒ Link
Initialize the Link component.
link_to supports. See ‘ActionView::Helpers::UrlHelper#link_to` for more details.
26 27 28 29 30 31 |
# File 'app/components/flowbite/link.rb', line 26 def initialize(href:, class: nil, **) super() @class = Array.wrap(binding.local_variable_get(:class)) @href = href @options = end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
11 12 13 |
# File 'app/components/flowbite/link.rb', line 11 def href @href end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'app/components/flowbite/link.rb', line 11 def @options end |
Class Method Details
.classes ⇒ Object
14 15 16 |
# File 'app/components/flowbite/link.rb', line 14 def classes ["font-medium", "text-fg-brand", "hover:underline"] end |
Instance Method Details
#call ⇒ Object
33 34 35 |
# File 'app/components/flowbite/link.rb', line 33 def call link_to(content, href, {class: classes}.merge()) end |