mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-04 13:52:06 +08:00
30 lines
1.4 KiB
Text
30 lines
1.4 KiB
Text
<%# locals: (name: nil, label: nil, type: "text", value: nil, attributes: {}, extra_class: nil, button_title: nil, prefix: nil) %>
|
|
<% value = typecast_body_params.str(name) || value if name
|
|
error = rodauth.field_error(name) || flash.dig("errors", name) %>
|
|
|
|
<div class="space-y-2 text-gray-900">
|
|
<% if label %>
|
|
<label for="<%= name %>" class="block text-sm font-medium leading-6"><%= label %></label>
|
|
<% end %>
|
|
<div class="flex">
|
|
<% if prefix %>
|
|
<div
|
|
class="flex shrink-0 items-center rounded-l-md bg-gray-50 px-3 text-base text-gray-500 outline outline-1 -outline-offset-1 outline-gray-300 sm:text-sm/6"
|
|
><%= prefix %></div>
|
|
<% end %>
|
|
<input
|
|
id="<%= name %>"
|
|
type="<%= type %>"
|
|
name="<%= name %>"
|
|
<% if value %>
|
|
value="<%= value %>"
|
|
<% end %>
|
|
class="block w-full border-0 py-1.5 pl-3 pr-10 shadow-sm ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6 <%= error ? "text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500" : "text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-orange-600"%> <%= prefix ? "rounded-r-md" : "rounded-md" %> <%= extra_class %>"
|
|
<%== html_attrs(attributes) %>
|
|
>
|
|
<% if button_title %>
|
|
<%== part("components/form/submit_button", text: button_title) %>
|
|
<% end %>
|
|
</div>
|
|
<%== part("components/form/error", name:, error:) if error %>
|
|
</div>
|