defuss-shadcn / Website / Account & States / profile-form
Built with: CSS
Profile FormBLK
Edits a user's personal information - photo, name, username, bio, website and time zone - as settings rows with a description beside each group. Part of the Account & States blocks.
On this page (2)
§Default
Settings rows - a heading and description beside the fields from 48rem: the photo (a button-styled label around a file input), names with autocomplete, a username with a prefix addon, a bio with maxlength, website and time zone; actions stick to the bottom.
§CSS view file
/* -- Profile Form (website · Account & States) ---------------------------- Edits a user's personal information - photo, name, username, bio, website and time zone - as settings rows with a description beside each group. */@layer components { /* every box in the block measures border-box - the same on any page */ :where(.mk-profile-form, .mk-profile-form *, .mk-profile-form ::before, .mk-profile-form ::after) { box-sizing: border-box; } .mk-profile-form { container: mk-profile-form / inline-size; width: 100%; } .mk-profile-form form { display: grid; } .mk-profile-form-section { display: grid; gap: 1rem 3rem; padding-block: 1.75rem; border-block-end: 1px solid var(--border); & > div:first-child h2 { margin: 0; font-size: 1rem; font-weight: 600; } & > div:first-child p { margin: 0.25rem 0 0; color: var(--muted-foreground); font-size: 0.875rem; } } .mk-profile-form-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 1rem; max-width: 36rem; } .mk-profile-form-field { display: grid; gap: 0.375rem; &[data-span="full"] { grid-column: 1 / -1; } } .mk-profile-form-hint { color: var(--muted-foreground); font-size: 0.8125rem; } .mk-profile-form-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; & .avatar { width: 4rem; height: 4rem; } } .mk-profile-form-upload { position: relative; overflow: hidden; & input { position: absolute; inset: 0; opacity: 0; cursor: pointer; } } .mk-profile-form-upload:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; } .mk-profile-form-prefix { display: flex; & span { display: grid; place-items: center; padding-inline: 0.75rem; border: 1px solid var(--input); border-inline-end: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--muted); color: var(--muted-foreground); font-size: 0.875rem; } & .input { border-start-start-radius: 0; border-end-start-radius: 0; } } .mk-profile-form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 0.5rem; padding-block: 1rem; background: var(--background); } @container mk-profile-form (min-width: 48rem) { .mk-profile-form-section { grid-template-columns: 16rem minmax(0, 1fr); } } /* -- Accessibility ------------------------------------------- */ @media (forced-colors: active) { .mk-profile-form-prefix span { border-color: CanvasText; } }}Comments, ideas or improvements? Edit this page's source on GitHub