Class: Shadcn::TabsTriggerComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/tabs_trigger_component.rb

Overview

Tabs Trigger component

Constant Summary collapse

BASE_CLASSES =
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(value:, disabled: false, **options) ⇒ TabsTriggerComponent

Returns a new instance of TabsTriggerComponent.

Parameters:

  • value (String)

    The value that identifies this tab

  • disabled (Boolean) (defaults to: false)

    Whether the tab is disabled



10
11
12
13
14
# File 'app/components/shadcn/tabs_trigger_component.rb', line 10

def initialize(value:, disabled: false, **options)
  super(**options)
  @value = value
  @disabled = disabled
end

Instance Method Details

#callObject



16
17
18
# File 'app/components/shadcn/tabs_trigger_component.rb', line 16

def call
  (:button, content, trigger_attributes)
end