Skip to content
Components

Field

Labels, controls and validation that stay connected.

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

<%= lc_field label: "Project name", id: "my-component-name", hint: "A short, memorable name.", class: "w-full max-w-sm" do |field| %>
  <%= lc_input name: "project[name]", **field %>
<% end %>
<%= lc_field label: "Project name", id: "example-0-name", hint: "A short, memorable name.", class: "w-full max-w-sm" do |field| %>
  <%= lc_input name: "project[name]", **field %>
<% end %>
<%= lc_field label: "Email address", id: "example-1-email", error: "Enter a valid email address.", class: "w-full max-w-sm" do |field| %>
  <%= lc_input name: "email", type: :email, value: "alex@", **field %>
<% end %>
<%= form_with scope: :project, url: "#", class: "w-full max-w-sm" do |form| %>
  <%= lc_field label: "Project name", id: form.field_id(:name), hint: "Works with Rails form builders." do |field| %>
    <%= form.text_field :name, **field, class: lc_input_class %>
  <% end %>
<% end %>
<%= lc_inline class: "justify-end" do %>
  <%= lc_button "Cancel", variant: :ghost %>
  <%= lc_button "Save changes", type: :submit %>
<% end %>
<%= lc_form_with model: DocsProject.invalid_example, url: "#", card: true, class: "w-full max-w-sm" do |form| %>
  <%= form.field :name, hint: "Shown to members." %>
  <%= form.field :email, as: :email_field, size: :sm, label: "Email (compact)" %>
  <%= form.switch :public, hint: "Anyone with the link can view." %>
  <%= form.submit "Save project" %>
<% end %>
<%= lc_stack class: "w-full max-w-sm" do %>
  <%= lc_fieldset legend: "Split", id: "example-5-split", hint: "Everyone pays the same share unless you change it." do %>
    <%= lc_inline do %>
      <%= lc_toggle "Equally", active: true %>
      <%= lc_toggle "By amount" %>
      <%= lc_toggle "By share" %>
    <% end %>
  <% end %>
  <%= lc_stack gap: :related do %>
    <%= lc_text "This app can", size: :label, tone: :muted %>
    <ul class="m-0 ps-5 list-disc text-muted-foreground">
      <li>Read your groups</li>
      <li>Add expenses</li>
    </ul>
  <% end %>
<% end %>
<%= lc_file_drop name: "files[]", title: "Add receipts", hint: "PDF or images, up to 10 MB each", button: "Browse files",
      accept: "image/*,application/pdf", multiple: true, class: "w-full max-w-md" %>

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_field

lc_field(label:, id:, hint: nil, error: nil, size: :md, **attributes, &block)
InputDefaultValues
labelRequiredAccessible name, visible where applicable
idRequired—
hintnil—
errornil—
size:md—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_fieldset

lc_fieldset(legend:, id: nil, hint: nil, error: nil, size: :md, **attributes, &block)
InputDefaultValues
legendRequired—
idnil—
hintnil—
errornil—
size:md—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_form_with

lc_form_with(card: false, padding: :md, gap: nil, **options, &block)
InputDefaultValues
cardfalsetrue · false
padding:md—
gapnil—
options{}—
blockCaptured blockCaptured Rails ERB content

lc_file_drop

lc_file_drop(name: nil, title:, hint: nil, button: nil, icon: "arrow-up-tray", accept: nil, multiple: false, input: {}, **attributes, &block)
InputDefaultValues
namenil—
titleRequired—
hintnil—
buttonnil—
icon"arrow-up-tray"Heroicon name; spacing is handled automatically
acceptnil—
multiplefalsetrue · false
input{}—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

The examples also use lc_input, lc_inline, lc_button, lc_stack, lc_toggle, and lc_text. 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