Class: Shadcn::InputGroup::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/input_group/component.rb

Overview

Port of registry/new-york-v4/ui/input-group.tsx

group/input-group is a named Tailwind group the addon's classes reach back into (group-has-[>input]/input-group:…), so the two halves only work as a pair.

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#call, #css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

This class inherits a constructor from Shadcn::ApplicationViewComponent

Instance Method Details

#element_attributes(**defaults) ⇒ Object

The controller lives on the group rather than on the addon, so that this.element is the group and the lookup matches upstream's currentTarget.parentElement.querySelector("input").



38
39
40
# File 'app/components/shadcn/input_group/component.rb', line 38

def element_attributes(**defaults)
  super(**{ role: "group", "data-controller" => "shadcn--input-group" }.merge(defaults))
end