Class: Shadcn::DropdownMenuLabelComponent

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

Overview

Dropdown Menu Label component

Constant Summary collapse

BASE_CLASSES =
"px-2 py-1.5 text-sm font-semibold"

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) ⇒ DropdownMenuLabelComponent

Returns a new instance of DropdownMenuLabelComponent.

Parameters:

  • inset (Boolean) (defaults to: false)

    Whether to add left padding



9
10
11
12
# File 'app/components/shadcn/dropdown_menu_label_component.rb', line 9

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

Instance Method Details

#callObject



14
15
16
# File 'app/components/shadcn/dropdown_menu_label_component.rb', line 14

def call
  (:div, content, class: cn(BASE_CLASSES, @inset ? "pl-8" : "", class_name))
end