<div class="container">
<div>
<h4 class="title">Underlined Inputs</h4>
<form>
<div class="omrs-input-group">
<label class="omrs-input-underlined">
<input required>
<span class="omrs-input-label">Normal</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
<div class="omrs-input-group">
<label class="omrs-input-underlined omrs-input-danger">
<input required>
<span class="omrs-input-label">Danger</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
<div class="omrs-input-group">
<label class="omrs-input-underlined">
<input required disabled>
<span class="omrs-input-label">Danger</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
</form>
</div>
<div>
<h4 class="title">Filled Inputs</h4>
<form>
<div class="omrs-input-group">
<label class="omrs-input-filled">
<input required>
<span class="omrs-input-label">Normal</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
<div class="omrs-input-group">
<label class="omrs-input-filled omrs-input-danger">
<input required>
<span class="omrs-input-label">Danger</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
<div class="omrs-input-group">
<label class="omrs-input-underlined">
<input required disabled>
<span class="omrs-input-label">Danger</span>
<span class="omrs-input-helper">Helper Text</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-5-6c.78 2.34 2.72 4 5 4s4.22-1.66 5-4H7z"/></svg>
</label>
</div>
</form>
</div>
</div>
/** BEGIN: Non Openmrs CSS **/
@import url("https://fonts.googleapis.com/css?family=Roboto&display=swap");
* {
font-family: "Roboto";
}
div.container {
display: flex;
align-items: flex-start;
justify-content: space-around;
margin-top: 30px;
border: 1px solid whitesmoke;
padding: 21px;
border-radius: 4px;
}
h4.title {
text-align: center;
margin-bottom: 45px;
}
:root {
--omrs-color-ink-lowest-contrast: rgba(47, 60, 85, 0.18);
--omrs-color-ink-low-contrast: rgba(60, 60, 67, 0.3);
--omrs-color-ink-medium-contrast: rgba(19, 19, 21, 0.6);
--omrs-color-interaction: #1e4bd1;
--omrs-color-interaction-minus-two: rgba(73, 133, 224, 0.12);
--omrs-color-danger: #b50706;
--omrs-color-bg-low-contrast: #eff1f2;
--omrs-color-ink-high-contrast: #121212;
--omrs-color-bg-high-contrast: #ffffff;
}
/** END: Non Openmrs CSS **/
div.omrs-input-group {
margin-bottom: 1.5rem;
position: relative;
width: 20.4375rem;
}
/* Input*/
.omrs-input-underlined > input,
.omrs-input-filled > input {
border: none;
border-bottom: 0.125rem solid var(--omrs-color-ink-medium-contrast);
width: 100%;
height: 2rem;
font-size: 1.0625rem;
padding-left: 0.875rem;
line-height: 147.6%;
padding-top: 0.825rem;
padding-bottom: 0.5rem;
}
.omrs-input-underlined > input:focus,
.omrs-input-filled > input:focus {
outline: none;
}
.omrs-input-underlined > .omrs-input-label,
.omrs-input-filled > .omrs-input-label {
position: absolute;
top: 0.9375rem;
left: 0.875rem;
line-height: 147.6%;
color: var(--omrs-color-ink-medium-contrast);
transition: top .2s;
}
.omrs-input-underlined > svg,
.omrs-input-filled > svg {
position: absolute;
top: 0.9375rem;
right: 0.875rem;
fill: var(--omrs-color-ink-medium-contrast);
}
.omrs-input-underlined > .omrs-input-helper,
.omrs-input-filled > .omrs-input-helper {
font-size: 0.9375rem;
color: var(--omrs-color-ink-medium-contrast);
letter-spacing: 0.0275rem;
margin: 0.125rem 0.875rem;
}
.omrs-input-underlined > input:hover,
.omrs-input-filled > input:hover {
background: var(--omrs-color-interaction-minus-two);
border-color: var(--omrs-color-ink-high-contrast);
}
.omrs-input-underlined > input:focus + .omrs-input-label,
.omrs-input-underlined > input:valid + .omrs-input-label,
.omrs-input-filled > input:focus + .omrs-input-label,
.omrs-input-filled > input:valid + .omrs-input-label {
top: 0;
font-size: 0.9375rem;
margin-bottom: 32px;;
}
.omrs-input-underlined:not(.omrs-input-danger) > input:focus + .omrs-input-label,
.omrs-input-filled:not(.omrs-input-danger) > input:focus + .omrs-input-label {
color: var(--omrs-color-interaction);
}
.omrs-input-underlined:not(.omrs-input-danger) > input:focus,
.omrs-input-filled:not(.omrs-input-danger) > input:focus {
border-color: var(--omrs-color-interaction);
}
.omrs-input-underlined:not(.omrs-input-danger) > input:focus ~ svg,
.omrs-input-filled:not(.omrs-input-danger) > input:focus ~ svg {
fill: var(--omrs-color-ink-high-contrast);
}
/** DISABLED **/
.omrs-input-underlined > input:disabled {
background: var(--omrs-color-bg-low-contrast);
cursor: not-allowed;
}
.omrs-input-underlined > input:disabled + .omrs-input-label,
.omrs-input-underlined > input:disabled ~ .omrs-input-helper{
color: var(--omrs-color-ink-low-contrast);
}
.omrs-input-underlined > input:disabled ~ svg {
fill: var(--omrs-color-ink-low-contrast);
}
/** DANGER **/
.omrs-input-underlined.omrs-input-danger > .omrs-input-label, .omrs-input-underlined.omrs-input-danger > .omrs-input-helper,
.omrs-input-filled.omrs-input-danger > .omrs-input-label, .omrs-input-filled.omrs-input-danger > .omrs-input-helper{
color: var(--omrs-color-danger);
}
.omrs-input-danger > svg {
fill: var(--omrs-color-danger);
}
.omrs-input-danger > input {
border-color: var(--omrs-color-danger);
}
.omrs-input-underlined > input {
background: var(--omrs-color-bg-high-contrast);
}
.omrs-input-filled > input {
background: var(--omrs-color-bg-low-contrast);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.