SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

AuthorCard

Who wrote the post, at its end or in a sidebar, as pieces a caller arranges.

View code
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

  • AuthorCard
  • AuthorCard.PortraitThe author's picture: an avatar from image or initials, 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 an href.
  • 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 a NewsletterForm.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeDefaultRequiredDescription
layout"row" | "stack"—Norow sets the portrait beside the details, for the end of a post; stack sets it above, for a narrow sidebar.
variant"plain" | "tinted"—Noplain 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

PropTypeDefaultRequiredDescription
imagestring—NoThe avatar's address; the name beside it describes it.
initialsstring—NoDrawn 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

PropTypeDefaultRequiredDescription
hrefstring—NoThe author's page, such as an about page.

Also accepts everything in TagProps<"p">.

AuthorCard.Subtitle

AuthorCard.Bio

Also accepts everything in TagProps<"ul">.

PropTypeDefaultRequiredDescription
hrefstring—Yes

Also accepts everything in TagProps<"li">.

Also accepts everything in TagProps<"div">.

@sdxc/ui

Can’t find it? Contact us