Class: BetterUi::Tabs::PanelComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- BetterUi::Tabs::PanelComponent
- Defined in:
- app/components/better_ui/tabs/panel_component.rb
Overview
A tab panel component that contains the content for a single tab.
This component renders the panel content with proper ARIA attributes for accessibility. Used in JS mode where all panel content is present in the DOM.
Constant Summary
Constants inherited from ApplicationComponent
ApplicationComponent::SHADOWS, ApplicationComponent::VARIANTS, ApplicationComponent::VARIANT_BODY_DIVIDE, ApplicationComponent::VARIANT_DIVIDE, ApplicationComponent::VARIANT_HEADER_BG, ApplicationComponent::VARIANT_HEADER_TEXT, ApplicationComponent::VARIANT_HIGHLIGHTED, ApplicationComponent::VARIANT_HOVERABLE, ApplicationComponent::VARIANT_RING, ApplicationComponent::VARIANT_SORT_ICON, ApplicationComponent::VARIANT_STRIPED
Instance Attribute Summary collapse
-
#active ⇒ Boolean
readonly
Returns whether this panel is active (visible).
-
#id ⇒ String
readonly
Returns the panel ID.
Instance Method Summary collapse
-
#initialize(id:, active: false, container_id: nil, **options) ⇒ PanelComponent
constructor
Initializes a new panel component.
-
#panel_element_id ⇒ String
Returns the panel element ID.
-
#tab_element_id ⇒ String
Returns the corresponding tab element ID.
Constructor Details
#initialize(id:, active: false, container_id: nil, **options) ⇒ PanelComponent
Initializes a new panel component.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/better_ui/tabs/panel_component.rb', line 27 def initialize( id:, active: false, container_id: nil, ** ) @id = id @active = active @container_id = container_id = end |
Instance Attribute Details
#active ⇒ Boolean (readonly)
Returns whether this panel is active (visible).
45 46 47 |
# File 'app/components/better_ui/tabs/panel_component.rb', line 45 def active @active end |
#id ⇒ String (readonly)
Returns the panel ID.
41 42 43 |
# File 'app/components/better_ui/tabs/panel_component.rb', line 41 def id @id end |
Instance Method Details
#panel_element_id ⇒ String
Returns the panel element ID.
49 50 51 |
# File 'app/components/better_ui/tabs/panel_component.rb', line 49 def panel_element_id "#{@container_id}-panel-#{@id}" end |
#tab_element_id ⇒ String
Returns the corresponding tab element ID.
55 56 57 |
# File 'app/components/better_ui/tabs/panel_component.rb', line 55 def tab_element_id "#{@container_id}-tab-#{@id}" end |