Reference
Configuration
Four knobs on PhlexForms.configure: theme, inference, variants, and the icon renderer.
PhlexForms.configure#
config/initializers/phlex_forms.rb
PhlexForms.configure do |c|
c.theme = :plain # :daisy (default when daisyui is loaded), :plain, or a Theme
c.infer_from_model = true # the model-driven inference kill switch
c.field_variants = [:primary] # global variants under every field's input
c.icon_renderer = PhlexForms::Configuration.glyphs_renderer
endReset with PhlexForms.reset_configuration! (handy in test suites).
The knobs#
| Knob | Default | Effect |
|---|---|---|
theme | daisy when daisyui is loaded, else plain | The default theme. Accepts :daisy, :plain, or a PhlexForms::Theme instance. Per-form theme: and form_options theme: override it. |
infer_from_model | true | Gates structure/column/validator inference. false restores pure attribute-name inference — the pre-inference rendering. |
field_variants | [] | daisyUI variants prepended to every field's inner input, beneath form-level and call-site variants. |
icon_renderer | bundled inline SVG | A callable ->(name, **opts) returning a renderable, used wherever the gem draws an icon. |
Icons#
The default renderer is a bundled inline SVG, so the gem renders identically with no host setup. To resolve icons from your app's glyphs / rails_icons asset tree instead:
config/initializers/phlex_forms.rb
PhlexForms.configure do |c|
c.icon_renderer = PhlexForms::Configuration.glyphs_renderer
endglyphs is deliberately not the default: rails_icons reads SVGs from the host app's asset paths, which a minimal host has not set up — the inline default can never raise.