Menu
render Label.new(href: "#") { "Email address" }
Add the component to your project
Run the following command in your terminal
bundle exec essence add label
Add the following code and libraries into your project
# frozen_string_literal: true
class Components::Label < Components::Essence
def initialize(**attributes)
super(**attributes)
end
def view_template(&) = label(**attributes, &)
def asterisk(**) = span(**m(**)) { "*" }
def helper_text(**, &) = p(**m(**), &)
private
def component_classes
{
_: {
_: "flex text-sm font-medium text-gray-700"
},
asterisk: {
_: "text-rose-500 font-normal mx-0.5"
},
helper_text: {
_: "text-xs font-normal text-gray-500"
}
}.freeze
end
end