Class: Fluxbit::LinkComponent
- Includes:
- Config::LinkComponent
- Defined in:
- app/components/fluxbit/link_component.rb
Overview
The ‘Fluxbit::LinkComponent` is a customizable link component that extends Component. It provides a straightforward way to generate anchor elements (`<a>`) with configurable colors and styling options. Additional HTML attributes can be passed to further control the component’s behavior and appearance.
Example usage:
= render Fluxbit::LinkComponent.new(size: 2, spacing: :wider, line_height: :relaxed) do
"My Heading"
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ Fluxbit::LinkComponent
constructor
Initializes the link component with the provided options.
Methods inherited from Component
#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #icon, #options, #popover?, #random_id, #remove_class, #remove_class_from_props, #render_popover_or_tooltip, #target, #tooltip?
Methods included from IconHelpers
#chevron_double_left, #chevron_double_right, #chevron_down, #chevron_left, #chevron_right, #chevron_up, #close_icon, #ellipsis_horizontal, #eye_icon, #eye_slash_icon, #plus_icon
Constructor Details
#initialize(**props) ⇒ Fluxbit::LinkComponent
Initializes the link component with the provided options.
29 30 31 32 33 34 35 36 37 |
# File 'app/components/fluxbit/link_component.rb', line 29 def initialize(**props) super @props = props @color = @props.delete(:color) || @@color add to: @props, class: [ styles[:colors][@color], styles[:base] ] @props[:class] = remove_class(@props.delete(:remove_class) || "", @props[:class]) @href = @props.delete(:href) || "#" end |
Instance Method Details
#call ⇒ Object
39 40 41 |
# File 'app/components/fluxbit/link_component.rb', line 39 def call link_to content, @href, **@props end |