Class: Shadcn::SelectItemComponent

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

Overview

Select Item component

Constant Summary collapse

BASE_CLASSES =
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none 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(value:, disabled: false, **options, &block) ⇒ SelectItemComponent

Returns a new instance of SelectItemComponent.

Parameters:

  • value (String)

    The value for this option

  • disabled (Boolean) (defaults to: false)

    Whether this option is disabled



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

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

Instance Method Details

#callObject



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

def call
  (:div, item_content, item_attributes)
end