Class: Shadcn::MenubarCheckboxItemComponent

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

Overview

Menubar 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 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) ⇒ MenubarCheckboxItemComponent

Returns a new instance of MenubarCheckboxItemComponent.

Parameters:

  • (defaults to: false)

    Whether item is checked

  • (defaults to: false)

    Whether item is disabled



15
16
17
18
19
# File 'app/components/shadcn/menubar_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/menubar_checkbox_item_component.rb', line 21

def call
  (:div, item_content, item_attributes)
end