Usage with Stimulus - richardvenneman/floatl GitHub Wiki
Create a controller:
import { Controller } from 'stimulus'
import Floatl from 'floatl'
export default class extends Controller {
connect () {
this.floatl = new Floatl(this.element)
}
disconnect () {
this.floatl.destroy()
}
}
Connect the controller with the data-controller
attribute on your floatl element:
<div class="floatl" data-controller="floatl">
<%= f.label :name, class: 'floatl__label' %>
<%= f.text_field :name, class: 'floatl__input', placeholder: 'Name' %>
</div>