Floating label
The label sits inside the field until you type, then moves up into the border.
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-input-floating-label">
<div class="fl"><input id="ukc-fl1" type="text" placeholder=" "><label for="ukc-fl1">Full name</label></div>
<div class="fl"><input id="ukc-fl2" type="email" placeholder=" " value="mara@reyesframing.com"><label for="ukc-fl2">Email</label></div>
</div>
.ukc-input-floating-label { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-input-floating-label *, .ukc-input-floating-label *::before, .ukc-input-floating-label *::after { box-sizing: border-box; }
.ukc-input-floating-label :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-input-floating-label :where(ul, ol) { padding: 0; list-style: none; }
.ukc-input-floating-label :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-input-floating-label :where(a) { color: inherit; }
.ukc-input-floating-label svg { flex: none; }
.ukc-input-floating-label .fl { position: relative; max-width: 340px; margin-bottom: 14px; }
.ukc-input-floating-label input { width: 100%; height: 52px; padding: 18px 14px 6px; border: 1px solid var(--uk-line); border-radius: var(--uk-radius-md); background: var(--uk-paper); font-size: 16px; }
.ukc-input-floating-label label { position: absolute; left: 14px; top: 16px; color: var(--uk-muted); pointer-events: none; transition: top var(--uk-motion-duration, 160ms) var(--uk-motion-ease, ease), font-size var(--uk-motion-duration, 160ms) var(--uk-motion-ease, ease), color var(--uk-motion-duration, 160ms) var(--uk-motion-ease, ease); }
.ukc-input-floating-label input:focus { outline: none; border-color: var(--uk-accent); box-shadow: 0 0 0 3px var(--tint); }
.ukc-input-floating-label input:focus + label, .ukc-input-floating-label input:not(:placeholder-shown) + label { top: 6px; font-size: 12px; color: var(--uk-accent); }
More inputs
All 27One email a month. Unsubscribe from any issue.
- /
- $USDhttps://.apphours
You have 186 characters left94 / 280