Class: Shadcn::MenubarSubTriggerComponent

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

Overview

Menubar Sub Trigger component Button that opens a submenu

Constant Summary collapse

BASE_CLASSES =
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground"

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(inset: false, **options, &block) ⇒ MenubarSubTriggerComponent

Returns a new instance of MenubarSubTriggerComponent.

Parameters:

  • inset (Boolean) (defaults to: false)

    Whether to add left padding



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

def initialize(inset: false, **options, &block)
  super(**options, &block)
  @inset = inset
end

Instance Method Details

#callObject



15
16
17
# File 'app/components/shadcn/menubar_sub_trigger_component.rb', line 15

def call
  (:div, trigger_content, trigger_attributes)
end