| Class name | Type | Description |
|---|---|---|
label |
Component | For styling the text next to an input field (or select) |
floating-label |
Component | For the parent of an input field (or select) and a span that floats above the input field when the field is focused |
<label class="input">
<span class="label">https://</span>
<input type="text" placeholder="URL" />
</label>
label(
[
span([Component.text('https://')], classes: 'label'),
input(type: InputType.text, attributes: {'placeholder': 'URL'}),
],
classes: 'input',
);
<label class="input">
<input type="text" placeholder="domain name" />
<span class="label">.com</span>
</label>
label(
[
input(type: InputType.text, attributes: {'placeholder': 'domain name'}),
span([Component.text('.com')], classes: 'label'),
],
classes: 'input',
);
<label class="select">
<span class="label">Type</span>
<select>
<option>Personal</option>
<option>Business</option>
</select>
</label>
label(
[
span([Component.text('Type')], classes: 'label'),
select([option([Component.text('Personal')]), option([Component.text('Business')])]),
],
classes: 'select',
);
<label class="input">
<span class="label">Publish date</span>
<input type="date" />
</label>
label(
[
span([Component.text('Publish date')], classes: 'label'),
input(type: InputType.date),
],
classes: 'input',
);
<label class="floating-label">
<span>Your Email</span>
<input type="text" placeholder="mail@site.com" class="input input-md" />
</label>
FloatingLabel(
[
span([Component.text('Your Email')]),
Input(const [], size: InputSize.md, placeholder: 'mail@site.com'),
],
);
<label class="floating-label">
<input type="text" placeholder="Extra Small" class="input input-xs" />
<span>Extra Small</span>
</label>
<label class="floating-label">
<input type="text" placeholder="Small" class="input input-sm" />
<span>Small</span>
</label>
<label class="floating-label">
<input type="text" placeholder="Medium" class="input input-md" />
<span>Medium</span>
</label>
<label class="floating-label">
<input type="text" placeholder="Large" class="input input-lg" />
<span>Large</span>
</label>
<label class="floating-label">
<input type="text" placeholder="Extra Large" class="input input-xl" />
<span>Extra Large</span>
</label>
Component.fragment([
FloatingLabel(
[
Input(const [], size: InputSize.xs, placeholder: 'Extra Small'),
span([Component.text('Extra Small')]),
],
),
FloatingLabel(
[
Input(const [], size: InputSize.sm, placeholder: 'Small'),
span([Component.text('Small')]),
],
),
FloatingLabel(
[
Input(const [], size: InputSize.md, placeholder: 'Medium'),
span([Component.text('Medium')]),
],
),
FloatingLabel(
[
Input(const [], size: InputSize.lg, placeholder: 'Large'),
span([Component.text('Large')]),
],
),
FloatingLabel(
[
Input(const [], size: InputSize.xl, placeholder: 'Extra Large'),
span([Component.text('Extra Large')]),
],
),
]);
<label class="floating-label">
<input type="text" placeholder="Input" class="input input-xs sm:input-sm md:input-md lg:input-lg xl:input-xl" value="Placeholder" />
<span>Input</span>
</label>
<label class="floating-label">
<textarea placeholder="Textarea" class="textarea textarea-xs sm:textarea-sm md:textarea-md lg:textarea-lg xl:textarea-xl">Placeholder</textarea>
<span>Textarea</span>
</label>
<label class="floating-label">
<select class="select select-xs sm:select-sm md:select-md lg:select-lg xl:select-xl">
<option disabled="" selected="">Placeholder</option>
<option>Option</option>
</select>
<span>Select</span>
</label>
Component.fragment([
FloatingLabel(
[
Input(
const [],
classes: 'sm:input-sm md:input-md lg:input-lg xl:input-xl',
size: InputSize.xs,
placeholder: 'Input',
value: 'Placeholder',
),
span([Component.text('Input')]),
],
),
FloatingLabel(
[
Textarea(
[Component.text('Placeholder')],
classes: 'sm:textarea-sm md:textarea-md lg:textarea-lg xl:textarea-xl',
size: TextareaSize.xs,
placeholder: 'Textarea',
),
span([Component.text('Textarea')]),
],
),
FloatingLabel(
[
Select(
[
option([Component.text('Placeholder')], selected: true, disabled: true),
option([Component.text('Option')]),
],
classes: 'sm:select-sm md:select-md lg:select-lg xl:select-xl',
size: SelectSize.xs,
),
span([Component.text('Select')]),
],
),
]);