Login with image
A wide sign-in card with the form on one side and an image on the other, which hides on phones.
Installation
Usage
Swap the illustration for a photo of your product or brand. The image is decorative (alt="") and hidden below 768px, where the form takes the whole card.
Accessibility
- The image is decorative, so it is skipped by screen readers.
- The form keeps visible labels and
autocompletefor password managers.
Dependencies
- Bootstrap 5.3+ CSS.
themes/tokens/tokens.css.- The
cardcomponent. - The
inputcomponent. - The
buttoncomponent.
Source
The exact files the CLI installs (login-image@1.0.0). View on GitHub · Report an issue
html
<section class="bootcn-login-image" aria-labelledby="bootcn-login-image-title">
<div class="card bootcn-card bootcn-login-image__card">
<div class="bootcn-login-image__body">
<div class="bootcn-login-image__intro">
<h2 class="bootcn-login-image__title" id="bootcn-login-image-title">Welcome back</h2>
<p class="bootcn-login-image__text">Sign in to your Acme account.</p>
</div>
<form class="bootcn-login-image__form" action="#" method="post">
<div class="bootcn-field">
<label for="bootcn-login-image-email" class="form-label bootcn-field__label">Email</label>
<input
type="email"
class="form-control bootcn-input"
id="bootcn-login-image-email"
name="email"
autocomplete="email"
placeholder="you@example.com"
required
/>
</div>
<div class="bootcn-field">
<div class="bootcn-login-image__label-row">
<label for="bootcn-login-image-password" class="form-label bootcn-field__label"
>Password</label
>
<a class="bootcn-login-image__link" href="#forgot-password">Forgot password?</a>
</div>
<input
type="password"
class="form-control bootcn-input"
id="bootcn-login-image-password"
name="password"
autocomplete="current-password"
required
/>
</div>
<button type="submit" class="btn bootcn-button bootcn-button--default w-100">
Sign in
</button>
</form>
<p class="bootcn-login-image__footer">
No account yet? <a class="bootcn-login-image__link" href="#sign-up">Create one</a>
</p>
</div>
<div class="bootcn-login-image__media">
<img
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 500' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%233f3f46'/%3E%3Cstop offset='1' stop-color='%2309090b'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='400' height='500' fill='url(%23g)'/%3E%3Ccircle cx='300' cy='120' r='90' fill='%2360a5fa' fill-opacity='.35'/%3E%3Ccircle cx='110' cy='360' r='130' fill='%232dd4bf' fill-opacity='.25'/%3E%3Ccircle cx='250' cy='330' r='60' fill='%23a78bfa' fill-opacity='.35'/%3E%3C/svg%3E"
alt=""
/>
</div>
</div>
</section>css
.bootcn-login-image {
width: 100%;
max-width: 52rem;
margin-inline: auto;
}
.bootcn-login-image__card {
display: grid;
}
@media (min-width: 768px) {
.bootcn-login-image__card {
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
}
.bootcn-login-image__body {
display: flex;
flex-direction: column;
gap: 1.5rem;
padding: 2rem;
}
.bootcn-login-image__intro {
text-align: center;
}
.bootcn-login-image__title {
margin: 0;
font-size: 1.5rem;
font-weight: 700;
}
.bootcn-login-image__text {
margin: 0.25rem 0 0;
color: var(--bootcn-muted-foreground);
}
.bootcn-login-image__form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.bootcn-login-image__form .bootcn-field {
margin: 0;
}
.bootcn-login-image__label-row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 1rem;
}
.bootcn-login-image__link {
color: var(--bs-link-color);
font-size: 0.875rem;
text-underline-offset: 0.2em;
}
.bootcn-login-image__footer {
margin: 0;
color: var(--bootcn-muted-foreground);
font-size: 0.875rem;
text-align: center;
}
.bootcn-login-image__media {
display: none;
background-color: var(--bootcn-muted);
}
@media (min-width: 768px) {
.bootcn-login-image__media {
display: block;
}
}
.bootcn-login-image__media img {
width: 100%;
height: 100%;
object-fit: cover;
}
