defuss-shadcn / Website / Account & States / login-form
Built with: CSS
Login FormBLK
Authenticates a user with account credentials - email, password, "remember me" and a reset link, on a card, beside a picture, or plain. Part of the Account & States blocks.
On this page (4)
§Default
A centered card: email (autocomplete="username"), password (current-password) with the reset link in its label row, remember me and submit - password managers fill and save it.
§Split
data-variant='split': the form beside a picture with a customer quote, from 44rem; the picture steps aside on small screens.
§Minimal
data-variant='minimal': no card - for a page whose whole purpose is signing in.
§CSS view file
/* -- Login Form (website · Account & States) ------------------------------ Authenticates a user with account credentials - email, password, "remember me" and a reset link, on a card, beside a picture, or plain. */@layer components { /* every box in the block measures border-box - the same on any page */ :where(.mk-login-form, .mk-login-form *, .mk-login-form ::before, .mk-login-form ::after) { box-sizing: border-box; } .mk-login-form { container: mk-login-form / inline-size; display: grid; gap: 1.5rem; width: 100%; max-width: 24rem; margin-inline: auto; padding: 2rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); color: var(--card-foreground); box-shadow: var(--shadow-sm); } .mk-login-form-head { display: grid; justify-items: center; gap: 0.5rem; text-align: center; & > svg { width: 2rem; height: 2rem; color: var(--primary); } & h1, & h2 { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; } & p { margin: 0; color: var(--muted-foreground); font-size: 0.9375rem; text-wrap: pretty; } } .mk-login-form form { display: grid; gap: 1rem; } .mk-login-form .mk-auth-field { display: grid; gap: 0.375rem; } .mk-login-form-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.875rem; & a { color: var(--primary); font-weight: 500; text-decoration: none; } & a:hover { text-decoration: underline; text-underline-offset: 3px; } } .mk-login-form-foot { margin: 0; color: var(--muted-foreground); font-size: 0.875rem; text-align: center; & a { color: var(--primary); font-weight: 600; text-decoration: none; } & a:hover { text-decoration: underline; text-underline-offset: 3px; } } .mk-login-form-label-row { display: flex; align-items: baseline; justify-content: space-between; & a { color: var(--primary); font-size: 0.8125rem; font-weight: 500; text-decoration: none; } & a:hover { text-decoration: underline; text-underline-offset: 3px; } } .mk-login-form .btn[type="submit"] { width: 100%; } .mk-login-form[data-variant="split"] { max-width: 56rem; padding: 0; overflow: hidden; grid-template-columns: minmax(0, 1fr); } .mk-login-form-panel { display: grid; gap: 1.5rem; padding: 2rem; } .mk-login-form-aside { position: relative; display: none; align-content: end; min-height: 100%; padding: 2rem; color: #fff; isolation: isolate; & img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; } &::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(transparent 30%, oklch(0.12 0.02 260 / 0.85)); } & blockquote { margin: 0; font-size: 1.125rem; line-height: 1.5; } & figcaption { margin-block-start: 0.75rem; font-size: 0.875rem; opacity: 0.8; } } @container mk-login-form (min-width: 44rem) { .mk-login-form-panel { padding: 3rem; } .mk-login-form-aside { display: grid; } .mk-login-form-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } } .mk-login-form[data-variant="minimal"] { border: 0; background: transparent; box-shadow: none; padding: 0; } /* -- Accessibility ------------------------------------------- */ @media (forced-colors: active) { .mk-login-form { border-color: CanvasText; } }}Comments, ideas or improvements? Edit this page's source on GitHub