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.
24 25 26 27 28 29 |
# File 'app/components/flowbite/link.rb', line 24 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.
9 10 11 |
# File 'app/components/flowbite/link.rb', line 9 def href @href end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'app/components/flowbite/link.rb', line 9 def @options end |
Class Method Details
.classes ⇒ Object
12 13 14 |
# File 'app/components/flowbite/link.rb', line 12 def classes ["font-medium", "text-fg-brand", "hover:underline"] end |
Instance Method Details
#call ⇒ Object
31 32 33 |
# File 'app/components/flowbite/link.rb', line 31 def call link_to(content, href, {class: classes}.merge()) end |