Label Edit

Displays a clickable label that will focus the associated form field.

Examples

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.