defuss-shadcn / Website / Article / author-bio
Author BioBLK
Introduces one author with a portrait, biography, and links - between rules under an article, on a card, or as a centered profile. Part of the Article blocks.
On this page (6)
§Default
A row between rules - portrait (Avatar), label, the name linking to the author page, role, biography and icon links.
§Card
data-variant='card': a raised profile card - a primary wash from the corner, a shadow and a ringed portrait - with the topics the author writes about (Badges) and a Follow Toggle. For sidebars and author pages; the default stays the quiet byline under an article.
§Centered
data-variant='centered': a profile stack - the top of an author page.
§Cover with stats
data-variant='cover': a banner on top and the portrait overlapping it; Statistics for the numbers and a Follow Toggle (aria-pressed) - click it.
§Inline byline with a hover card
data-variant='inline': a one-row byline. The name opens a Popover with the full bio (a card variant inside) - a hover card for author names.
§CSS view file
/* -- Author Bio (website) ------------------------------------------- Introduces one author: portrait (Avatar), a label, the name (linking to the author page), role, biography and links (icon buttons). Default: a row between rules; card: on a surface; centered: a profile stack. */@layer components { /* the body wraps under the portrait when the row is too narrow for both */ .mk-author-bio { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.25rem; box-sizing: border-box; width: 100%; padding-block: 1.5rem; border-block: 1px solid var(--border); & > .avatar { flex: none; } } .mk-author-bio-body { display: flex; flex: 1 1 16rem; flex-direction: column; gap: 0.25rem; min-width: 0; } .mk-author-bio-label { color: var(--muted-foreground); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; } .mk-author-bio-name { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; & a { color: inherit; text-decoration: none; &:hover { text-decoration: underline; text-underline-offset: 0.2em; } &:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); } } } .mk-author-bio-role { margin: 0; color: var(--muted-foreground); font-size: 0.875rem; } .mk-author-bio-text { margin: 0.5rem 0 0; max-width: 40rem; font-size: 0.9375rem; line-height: 1.6; text-wrap: pretty; } .mk-author-bio-links { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.5rem 0 0 -0.375rem; padding: 0; list-style: none; } /* card: the bio on a surface */ /* card: a raised profile card - a primary wash from the corner, a shadow, the portrait ringed in the primary colour (sidebars, author pages) */ .mk-author-bio[data-variant="card"] { padding: 1.75rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: radial-gradient(90% 120% at 0% 0%, color-mix(in oklch, var(--primary) 10%, transparent), transparent 60%), var(--card); color: var(--card-foreground); box-shadow: var(--shadow-lg); & > .avatar { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--primary); } & .mk-author-bio-label { color: var(--primary); } } /* topics the author writes about (Badges) */ .mk-author-bio-topics { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-block-start: 0.75rem; } /* centered: a profile stack - portrait on top */ .mk-author-bio[data-variant="centered"] { flex-direction: column; align-items: center; border-block: 0; text-align: center; & .mk-author-bio-body { align-items: center; } & .mk-author-bio-links { justify-content: center; margin-inline: 0; } } /* a row of Statistics (articles, readers, since) */ .mk-author-bio-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin-block-start: 0.75rem; & .statistic { gap: 0; } & .statistic-value { font-size: 1.125rem; } } /* actions: follow / message */ .mk-author-bio-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-start: 0.75rem; } /* cover: a banner image on top, the portrait overlapping it */ .mk-author-bio[data-variant="cover"] { flex-direction: column; gap: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); & .mk-author-bio-cover { width: 100%; height: 7rem; margin: 0; object-fit: cover; background: var(--muted); } & > .avatar { margin: -2.5rem 0 0 1.5rem; box-shadow: 0 0 0 4px var(--card); } & .mk-author-bio-body { padding: 0.75rem 1.5rem 1.5rem; } } /* inline: a compact byline - one row, small portrait */ .mk-author-bio[data-variant="inline"] { align-items: center; gap: 0.75rem; padding-block: 0.75rem; & .mk-author-bio-body { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; flex: 1; } & .mk-author-bio-name { font-size: 0.9375rem; } & :is(.mk-author-bio-label, .mk-author-bio-role) { font-size: 0.8125rem; text-transform: none; letter-spacing: 0; font-weight: 400; } & :is(.mk-author-bio-text, .mk-author-bio-links, .mk-author-bio-stats) { display: none; } & .mk-author-bio-actions { margin: 0; } } /* -- Accessibility ------------------------------------------- */ @media (prefers-contrast: more) { .mk-author-bio-role, .mk-author-bio-label { color: var(--foreground); } } @media (forced-colors: active) { .mk-author-bio[data-variant="card"] { border-color: CanvasText; } }}Comments, ideas or improvements? Edit this page's source on GitHub