x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!-- Input With Default Label -->
<div class="">
<label class="block mb-2.5 text-sm font-medium text-heading" for="person_first_name">First name</label>
<input class="bg-neutral-secondary-medium border border-default-medium text-heading rounded-base focus:ring-brand focus:border-brand block w-full shadow-xs placeholder:text-body px-3 py-2.5 text-sm" type="text" value="John" name="person[first_name]" id="person_first_name" />
</div>
<!-- Input With Specified Label Text -->
<div class="">
<label class="block mb-2.5 text-sm font-medium text-heading" for="person_first_name">Custom label text</label>
<input class="bg-neutral-secondary-medium border border-default-medium text-heading rounded-base focus:ring-brand focus:border-brand block w-full shadow-xs placeholder:text-body px-3 py-2.5 text-sm" type="text" value="John" name="person[first_name]" id="person_first_name" />
</div>
<!-- Input With Specified Label Options -->
<div class="">
<label class="custom-label-class" for="person_first_name">First name</label>
<input class="bg-neutral-secondary-medium border border-default-medium text-heading rounded-base focus:ring-brand focus:border-brand block w-full shadow-xs placeholder:text-body px-3 py-2.5 text-sm" type="text" value="John" name="person[first_name]" id="person_first_name" />
</div>
<!-- Input With Custom Label -->
<div class="">
This is a custom label replacing the entire label
<input class="bg-neutral-secondary-medium border border-default-medium text-heading rounded-base focus:ring-brand focus:border-brand block w-full shadow-xs placeholder:text-body px-3 py-2.5 text-sm" type="text" value="John" name="person[first_name]" id="person_first_name" />
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Input With Default Label
render(
Flowbite::InputField::Text.new(
attribute: :first_name,
form: form
)
)
# Input With Specified Label Text
render(
Flowbite::InputField::Text.new(
attribute: :first_name,
form: form,
label: {content: "Custom label text"}
)
)
# Input With Specified Label Options
render(
Flowbite::InputField::Text.new(
attribute: :first_name,
form: form,
label: {options: {class: "custom-label-class"}}
)
)
# Input With Custom Label
render(
Flowbite::InputField::Text.new(
attribute: :first_name,
form: form
)
) do |input|
input.with_label do
"This is a custom label replacing the entire label"
end
end