Class: PhlexKit::InputGroupAddon
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::InputGroupAddon
- Defined in:
- app/components/phlex_kit/input_group/input_group_addon.rb
Overview
Addon inside an InputGroup — icons, text or small buttons. align: places
it: :start / :end inline beside the control (shadcn's inline-start/-end),
:block_start / :block_end as full-width header/footer rows (the group
stacks into a column). See input_group.rb.
Constant Summary collapse
- ALIGNS =
{ start: "start", end: "end", block_start: "block-start", block_end: "block-end" }.freeze
Instance Method Summary collapse
-
#initialize(align: :start, **attrs) ⇒ InputGroupAddon
constructor
A new instance of InputGroupAddon.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(align: :start, **attrs) ⇒ InputGroupAddon
Returns a new instance of InputGroupAddon.
14 15 16 17 |
# File 'app/components/phlex_kit/input_group/input_group_addon.rb', line 14 def initialize(align: :start, **attrs) @align = align.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
19 20 21 |
# File 'app/components/phlex_kit/input_group/input_group_addon.rb', line 19 def view_template(&) div(**mix({ class: "pk-input-group-addon #{fetch_option(ALIGNS, @align, :align)}", role: "group" }, @attrs), &) end |