Class: JetUi::Tabs::ItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- JetUi::Tabs::ItemComponent
- Defined in:
- app/components/jet_ui/tabs/item_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label = nil, href:, icon: nil, active: false, **options) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Constructor Details
#initialize(label = nil, href:, icon: nil, active: false, **options) ⇒ ItemComponent
Returns a new instance of ItemComponent.
6 7 8 9 10 11 12 |
# File 'app/components/jet_ui/tabs/item_component.rb', line 6 def initialize(label = nil, href:, icon: nil, active: false, **) @label = label @href = href @icon = icon @active = active @options = end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/components/jet_ui/tabs/item_component.rb', line 14 def call content_tag :li, class: 'tabs__item' do link_to @href, class: link_classes, **@options do concat render(JetUi::Icon::Component.new(@icon, size: 4)) if @icon concat(@label.presence || content) end end end |