Class: Shadcn::ContextMenuCheckboxItemComponent

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

Overview

Context Menu Checkbox Item component A menu item that can be checked/unchecked

Constant Summary collapse

BASE_CLASSES =
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"

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(checked: false, disabled: false, **options, &block) ⇒ ContextMenuCheckboxItemComponent

Returns a new instance of ContextMenuCheckboxItemComponent.

Parameters:

  • checked (Boolean) (defaults to: false)

    Whether item is checked

  • disabled (Boolean) (defaults to: false)

    Whether item is disabled



15
16
17
18
19
# File 'app/components/shadcn/context_menu_checkbox_item_component.rb', line 15

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

Instance Method Details

#callObject



21
22
23
# File 'app/components/shadcn/context_menu_checkbox_item_component.rb', line 21

def call
  (:div, item_content, item_attributes)
end