Stimulus Overlay Helpers

This gem adds two view helpers corresponding to the npm package @csedl/hotwire-svelte-helpers, to a rails app.

There is a online example rails app.

Links

Installation

add

gem 'stimulus-overlay-helpers'

to your Gemfile and run bundle install

Configuration

If you work with the helpers on this gem, you can setup a initializer for a custom close-button, like:

#=> config/initializers/stimulus_overlay_helpers.rb

StimulusDropdown.configure do |config|
  config.close_button_proc = ->(view) do
    view.(:span, 'X', class: 'close-button')
  end
end

Usage Examples

= dropdown('button-label-or-proc', class: 'fetch-from-server', src: optional_server_request_path) do
  'any content here ...'
= dropdown(->{inline_svg_tag("my-svg")}, class: 'fetch-from-server', src: optional_server_request_path) do
  'any content here ...'
= tooltip('tooltip-text-or-proc', class: 'primary-tooltip') do
    tooltip-content

License: MIT