Class: ShadcnPhlexcomponents::CommandItem
- Defined in:
- lib/shadcn_phlexcomponents/components/command.rb
Constant Summary
Constants inherited from Base
Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER
Instance Method Summary collapse
- #default_attributes ⇒ Object
-
#initialize(value: nil, aria_id: nil, **attributes) ⇒ CommandItem
constructor
A new instance of CommandItem.
- #view_template ⇒ Object
Methods inherited from Base
#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child
Constructor Details
#initialize(value: nil, aria_id: nil, **attributes) ⇒ CommandItem
Returns a new instance of CommandItem.
257 258 259 260 261 |
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 257 def initialize(value: nil, aria_id: nil, **attributes) @value = value @aria_id = aria_id super(**attributes) end |
Instance Method Details
#default_attributes ⇒ Object
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 267 def default_attributes { role: "option", tabindex: -1, aria: { labelledby: @aria_labelledby, }, data: { highlighted: "false", disabled: @disabled, value: @value, action: <<~HEREDOC, click->command#select mouseover->command#highlightItem HEREDOC command_target: "item", }, } end |
#view_template ⇒ Object
263 264 265 |
# File 'lib/shadcn_phlexcomponents/components/command.rb', line 263 def view_template(&) div(**@attributes, &) end |