Skip to main content

Customize

Plugin Outlets

FormKit works seamlessly with <PluginOutlet />. You can use plugin outlets inside your form to extend its functionality:

<Form as |form|>
<PluginOutlet @name="above-foo-form" @outletArgs={{hash form=form}} />
</Form>

Then, in your connector, you can use the outlet arguments to add custom fields:

connectors/above-foo-form/bar-input.hbs
<@outletArgs.form.Field @name="bar" as |field|>
<field.Input />
</@outletArgs.form.Field>

Styling

All FormKit components propagate attributes, allowing you to set classes and data attributes, for example:

<Form class="my-form" as |form|>
<form.Field class="my-field" as |field|>
<field.Input class="my-control" />
</form.Field>
</Form>

Custom Control

Creating a custom control is straightforward with the properties yielded by form and field:

<Form as |form|>
<form.Field class="my-field" as |field|>
<field.Custom>
<MyCustomControl id={{field.id}} @onChange={{field.set}} />
</field.Custom>
</form.Field>
</Form>

Available Parameters on form

NameDescription
setAllows you to set the value of any field by name: set("bar", 1)

Available Parameters on field

NameDescription
idID to be used on the control for accessibility
nameName of the field
valueThe value of the field