Module: UI::TabsListBehavior

Included in:
TabsList, TabsListComponent
Defined in:
app/behaviors/ui/tabs_list_behavior.rb

Overview

Shared behavior for TabsList component Container for tab triggers

Instance Method Summary collapse

Instance Method Details

#list_html_attributesObject

Build complete HTML attributes hash for tabs list



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/behaviors/ui/tabs_list_behavior.rb', line 7

def list_html_attributes
  base_attrs = @attributes&.except(:data) || {}
  user_data = @attributes&.fetch(:data, {}) || {}

  base_attrs.merge(
    class: "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px] #{@classes}".strip,
    "data-orientation": @orientation || "horizontal",
    "data-slot": "tabs-list",
    role: "tablist",
    "aria-orientation": @orientation || "horizontal",
    data: user_data
  )
end