AuthorCard
Who wrote the post, at its end or in a sidebar, as pieces a caller arranges.
View code
<AuthorCard>
<AuthorCard.Portrait initials="MH" />
<AuthorCard.Details>
<AuthorCard.Name href="/about">Maren Holt</AuthorCard.Name>
<AuthorCard.Subtitle>Writes about small tools and slow software</AuthorCard.Subtitle>
<AuthorCard.Bio>
Maren builds command lines for a living and keeps a notebook of the ones she wishes existed.
</AuthorCard.Bio>
<AuthorCard.Links>
<AuthorCard.Link href="https://maren.example.com">Website</AuthorCard.Link>
<AuthorCard.Link href="/feed.xml">RSS feed</AuthorCard.Link>
</AuthorCard.Links>
</AuthorCard.Details>
<AuthorCard.Footer>
<NewsletterForm action="/subscribe">
<NewsletterForm.Field>
<NewsletterForm.Label>Get the monthly letter</NewsletterForm.Label>
<NewsletterForm.Input />
</NewsletterForm.Field>
<NewsletterForm.Submit>Subscribe</NewsletterForm.Submit>
</NewsletterForm>
</AuthorCard.Footer>
</AuthorCard>
{/* In a sidebar */}
<AuthorCard layout="stack" variant="tinted">
<AuthorCard.Portrait initials="MH" />
<AuthorCard.Details>
<AuthorCard.Name href="/about">Maren Holt</AuthorCard.Name>
<AuthorCard.Subtitle>Editor</AuthorCard.Subtitle>
</AuthorCard.Details>
</AuthorCard>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { AuthorCard } from "@sdxc/ui/blog";Renders an <aside> landmark, named "About the author" unless the caller passes its own
aria-label. A .Portrait sits beside the .Details in a row and above them in a
stack; a .Footer spans the card under both. Restyle through AuthorCard.CustomProperties.
Composition
The parts the component publishes, each a static property of the host.
AuthorCardAuthorCard.PortraitThe author's picture: an avatar fromimageorinitials, or the children in its place, such as a framed photo.AuthorCard.DetailsThe column of text beside or under the portrait, stacking the name, subtitle, bio and links in the order written.AuthorCard.NameThe author's name, a quiet link when given anhref.AuthorCard.SubtitleA short muted line under the name, such as "Writes about type and the web".AuthorCard.BioA sentence or two about the author, set as running text a little apart from the name.AuthorCard.LinksThe places to read more from the author, as one wrapping row of.Links.AuthorCard.LinkOne place to read more from the author, a brand link in a list item.AuthorCard.FooterWhat closes the card across its width under the portrait and details, such as aNewsletterForm.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
layout | "row" | "stack" | — | No | row sets the portrait beside the details, for the end of a post; stack sets it above, for a narrow sidebar. |
variant | "plain" | "tinted" | — | No | plain opens on a rule, the way a post's footer separates its parts; tinted sets the card on a tinted, rounded surface. |
Also accepts everything in TagProps<"aside">.
AuthorCard.Portrait
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
image | string | — | No | The avatar's address; the name beside it describes it. |
initials | string | — | No | Drawn in the avatar when there is no image, or while it loads. |
Also accepts everything in TagProps<"span">.
AuthorCard.Details
Also accepts everything in TagProps<"div">.
AuthorCard.Name
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
href | string | — | No | The author's page, such as an about page. |
Also accepts everything in TagProps<"p">.
AuthorCard.Subtitle
AuthorCard.Bio
AuthorCard.Links
Also accepts everything in TagProps<"ul">.
AuthorCard.Link
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
href | string | — | Yes |
Also accepts everything in TagProps<"li">.
AuthorCard.Footer
Also accepts everything in TagProps<"div">.