Toggle Edit

A two-state button that can be either on or off.

Examples

Installation


  rails generate shadcn-ui toggle

Usage

  <%= render_toggle 'content' %>

The Toggle component introduces:

  • app/helpers/components/toggle_helper.rb
  • app/javascript/controllers/ui/toggle_controller.js
  • app/views/components/ui/_toggle.html.erb

render_toggle an argument for the content for the button that will become a toggle.