PrecheckedLabelledCheckboxFormControl

InfoGeneratePackages

This code is a Ruby component that creates a form control with a checkbox and a label. The label is styled to be clickable and contains the text "Remember me." The checkbox is automatically checked by default. The component allows customization of the checkbox's appearance through predefined color and size classes, although specific implementation details of these customizations are not included in the snippet. The component is designed to be used within a web application framework, indicated by its inheritance from ApplicationComponent.

# frozen_string_literal: true

# Checkbox can be modified by:
# color: checkbox-primary, checkbox-secondary, checkbox-accent, checkbox-success, checkbox-warning, checkbox-info, checkbox-error
# size: checkbox-lg, checkbox-md, checkbox-sm, checkbox-xs

class CheckboxWithLabelAndFormControlComponent < ApplicationComponent
  def template
    div(class: "form-control") do
      label(class: "label cursor-pointer") do
        span(class: "label-text") { "Remember me" }
        input(type: "checkbox", checked: "checked", class: "checkbox")
      end
    end
  end
end