Class: PhlexKit::FieldSeparator

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/field/field_separator.rb

Overview

Hairline between FieldGroups, optionally with centered text riding the line ("Or continue with"), ported from shadcn/ui's FieldSeparator. See field.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ FieldSeparator

Returns a new instance of FieldSeparator.



6
# File 'app/components/phlex_kit/field/field_separator.rb', line 6

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_template(&block) ⇒ Object



8
9
10
11
12
13
# File 'app/components/phlex_kit/field/field_separator.rb', line 8

def view_template(&block)
  div(**mix({ class: "pk-field-separator", data: { content: block ? "true" : "false" } }, @attrs)) do
    render Separator.new(class: "pk-field-separator-line")
    span(class: "pk-field-separator-content", &block) if block
  end
end