Switch
Um controle de alternância para estados booleanos ligado/desligado. Suporta tanto o modo form builder (com objetos de formulário Rails) quanto uso independente. Inclui rótulo, descrição e diferentes tamanhos.
Pré-visualização e Código
_switch.html.erb
███
██████ █████████ █████████
█████ ████ ████ ████████
███ █████████ ██████ █████ ██ ███ ██
███ ██████ ████████████████████ █████ ██ ██████████ ███████████████
██████ ███████ ███████████████ ████████████ ████████ █████ ██████ ███ █████████ ████████ ██
██ ███ ██
██████████ ██████
switch_controller.js
██████ █ ██████████ █ ████ ████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ █████████ ████████ ████████
██████ ██████ █ █
████████ █ █████ ████████ ████████ █████ █
█
█████████ █
████████████████████████
switch_component.html.erb
████ ██████████ █████████████████ ███
████████████████████████
██████████████████████████████ ███████████ ████
████ ███████████ █████████████
███████
█████████████
█████████████
█████████████████ ███████████ ███
██ ██ █████████ ██████████ ██████████████████████ ███ ██
██████████ █████████████ ███
switch_component.rb
█ ██████████████████████ ████
█████ ███████████████ █ ███████████████████
█████ █ █████ ██ ██████████
███████████ ██████ ███████████ ██████ █████████ ███████ █████████████
██████ ██████████ ██████
███ ███████████
█████ ████
switch_controller.js
██████ █ ██████████ █ ████ ████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ █████████ ████████ ████████
██████ ██████ █ █
████████ █ █████ ████████ ████████ █████ █
█
█████████ █
████████████████████████
Changelog
- Initial release with form builder and standalone modes
- Three size options: sm, md (default), lg
- Smooth toggle animation via Stimulus controller
- Automatic error detection from Rails form objects
- Dark mode support
Obter Acesso Completo
Desbloqueie o código-fonte deste componente e de todos os outros. Pagamento único para acesso vitalício.
Obter Acesso Agora