Usage
<%= form_with url: root_path do |f| %>
<%= f.toggler :push_notifications %>
<%= f.toggler :notifications, hint: "Enable notifications" %>
<% end %>Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | String | false | humanized attribute name | Custom label text. Set to `false` to hide the label. |
hint | String | nil | Helper text displayed below the toggler. |
Also accepts any HTML attributes via **options (e.g., id:, data:, aria:). class: is also supported for custom styling.
Examples
Basic Toggler
<%= form_with url: root_path do |f| %>
<%= f.group do %>
<%= f.toggler :basic_push_notifications %>
<% end %>
<%= f.group do %>
<%= f.toggler :basic_notifications, hint: "Here you can have a hint" %>
<% end %>
<% end %>