Class: Shadcn::ComboboxComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::ComboboxComponent
- Defined in:
- app/components/shadcn/combobox_component.rb
Overview
Combobox component - autocomplete input with searchable dropdown Composes Popover and Command components for a searchable select
Constant Summary collapse
- TRIGGER_CLASSES =
"w-[200px] justify-between"- POPOVER_CONTENT_CLASSES =
"w-[200px] p-0"- CHEVRON_CLASSES =
"ml-2 h-4 w-4 shrink-0 opacity-50"- CHECK_CLASSES =
"mr-2 h-4 w-4"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(items: [], value: nil, placeholder: "Select option...", search_placeholder: "Search...", empty_text: "No results found.", name: nil, disabled: false, width: "w-[200px]", **options) ⇒ ComboboxComponent
constructor
A new instance of ComboboxComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(items: [], value: nil, placeholder: "Select option...", search_placeholder: "Search...", empty_text: "No results found.", name: nil, disabled: false, width: "w-[200px]", **options) ⇒ ComboboxComponent
Returns a new instance of ComboboxComponent.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/components/shadcn/combobox_component.rb', line 46 def initialize( items: [], value: nil, placeholder: "Select option...", search_placeholder: "Search...", empty_text: "No results found.", name: nil, disabled: false, width: "w-[200px]", ** ) super(**) @items = items @value = value @placeholder = placeholder @search_placeholder = search_placeholder @empty_text = empty_text @name = name @disabled = disabled @width = width end |
Instance Method Details
#call ⇒ Object
68 69 70 |
# File 'app/components/shadcn/combobox_component.rb', line 68 def call content_tag(:div, combobox_content, **combobox_attributes) end |