Label Edit
Displays a clickable label that will focus the associated form field.
Examples
<%= render_label name: "sample_input",
label: "Sample Input",
class: "block text-left w-full" %>
<%= render_input name: "sample_input", id: "sample_input" %>
Installation
rails generate shadcn-ui label
Usage
<%= render_label name:, label: %>
The Label component introduces:
app/helpers/components/label_helper.rb
app/views/components/ui/_label.html.erb
The method render_label
defined in app/helpers/components/label_helper.rb
accepts two keyword arguments, name
and label
. The name
argument is used to generate the for
attributes. The label
argument is used as the text for the label.