Class: UI::TabsContent

Inherits:
Phlex::HTML
  • Object
show all
Includes:
TabsContentBehavior
Defined in:
app/components/ui/tabs_content.rb

Overview

TabsContent component (Phlex) Panel displaying content for active tab

Examples:

Basic usage

render UI::Content.new(value: "account") do
  "Account settings content"
end

Instance Method Summary collapse

Methods included from TabsContentBehavior

#content_html_attributes, #content_state

Constructor Details

#initialize(value: "", default_value: "", orientation: "horizontal", classes: "", attributes: {}) ⇒ TabsContent

Returns a new instance of TabsContent.

Parameters:

  • value (String) (defaults to: "")

    unique identifier for this content panel

  • default_value (String) (defaults to: "")

    currently active tab value

  • orientation (String) (defaults to: "horizontal")

    “horizontal” or “vertical”

  • classes (String) (defaults to: "")

    additional CSS classes

  • attributes (Hash) (defaults to: {})

    additional HTML attributes



18
19
20
21
22
23
24
25
# File 'app/components/ui/tabs_content.rb', line 18

def initialize(value: "", default_value: "", orientation: "horizontal", classes: "", attributes: {}, **)
  @value = value
  @default_value = default_value
  @orientation = orientation
  @classes = classes
  @attributes = attributes
  super()
end

Instance Method Details

#view_template(&block) ⇒ Object



27
28
29
# File 'app/components/ui/tabs_content.rb', line 27

def view_template(&block)
  div(**content_html_attributes, &block)
end