Skip to content
Components

Checkbox

Native checkboxes with labels and hints.

After the one-time setup, call the helper directly from ERB. No component import is needed.

<%= lc_stack gap: :related do %>
  <%= lc_checkbox "Email me about comments", name: "notify[comments]", checked: true %>
  <%= lc_checkbox "Weekly digest", name: "notify[digest]", hint: "A summary every Monday." %>
  <%= lc_checkbox "Product news", name: "notify[news]", disabled: true %>
<% end %>
<%= lc_stack gap: :related do %>
  <%= lc_checkbox "Email me about comments", name: "notify[comments]", checked: true %>
  <%= lc_checkbox "Weekly digest", name: "notify[digest]", hint: "A summary every Monday." %>
  <%= lc_checkbox "Product news", name: "notify[news]", disabled: true %>
<% end %>

Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.

lc_checkbox

lc_checkbox(label, name: nil, value: "1", checked: false, unchecked_value: "0", hint: nil, card: false, **attributes, &block)
InputDefaultValues
labelRequiredAccessible name, visible where applicable
namenil—
value"1"—
checkedfalsetrue · false
unchecked_value"0"—
hintnil—
cardfalsetrue · false
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

The examples also use lc_stack. Each is documented on its own page.

Styling and extension

Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.

API JSON · LLM reference