Data displayAuthorBox
Searchastronomic.dev# AuthorBox
At the end of a post or on an author page: the writer's photo, name, role, a short bio and their links.
Static: no JavaScript.
## Usage
```astro
import AuthorBox from "@astronomic-dev/ui/components/AuthorBox.astro";
```
## Examples
### At the end of a post
From a 28rem box the 6rem photo sits beside the text: the name, the role, the bio, then the all-posts link and the icon links as round buttons.
```astro
---
import Globe from "@lucide/astro/icons/globe";
import Mail from "@lucide/astro/icons/mail";
import Rss from "@lucide/astro/icons/rss";
import AuthorBox from "@astronomic-dev/ui/components/AuthorBox.astro";
// Your own photo.
import ada from "../../photos/portrait-curly-hair.webp";
---
<div class="mx-auto max-w-2xl">
<AuthorBox
name="Ada Brook"
role="Founder · Design"
bio="Ada started Astronomic after ten years of designing sites for law firms and clinics. She writes the journal's notes on process, and signs off every design before it goes to the build."
image={{ src: ada }}
viewAll={{ label: "All posts by Ada", href: "#ada" }}
links={[
{ label: "Email", href: "mailto:ada@example.com", icon: Mail },
{ label: "Portfolio", href: "#ada-portfolio", icon: Globe },
{ label: "RSS", href: "#ada-rss", icon: Rss },
]}
/>
</div>
```
### In a side column
In a 16rem column the photo (4rem) sits above the name; the same part, sized by its own box.
```astro
---
import Mail from "@lucide/astro/icons/mail";
import Rss from "@lucide/astro/icons/rss";
import AuthorBox from "@astronomic-dev/ui/components/AuthorBox.astro";
// Your own photo.
import jonas from "../../photos/portrait-grey-hair.webp";
---
<!-- A 16rem column, as a theme's side column: the photo sits above the name. -->
<div>
<div class="w-64 max-w-full">
<AuthorBox
name="Jonas Weber"
role="Developer"
bio="Jonas builds the pages and the editing setup, and writes about what breaks."
image={{ src: jonas }}
viewAll={{ label: "All posts by Jonas", href: "#jonas" }}
links={[
{ label: "Email", href: "mailto:jonas@example.com", icon: Mail },
{ label: "RSS", href: "#jonas-rss", icon: Rss },
]}
/>
</div>
</div>
```
### Many links
Seven links in a 16rem column: the text links (one a single letter) and the round icon links wrap to several rows. On a touch screen each link is a 44px box, so no two overlap.
```astro
---
import Globe from "@lucide/astro/icons/globe";
import Mail from "@lucide/astro/icons/mail";
import Rss from "@lucide/astro/icons/rss";
import AuthorBox from "@astronomic-dev/ui/components/AuthorBox.astro";
---
<!-- Many links in a narrow column: they wrap to several rows, one label is a single letter. On a touch screen each is a 44px box. -->
<div>
<div class="w-64 max-w-full">
<AuthorBox
name="Jonas Weber"
role="Developer"
viewAll={{ label: "All posts by Jonas", href: "#jonas" }}
links={[
{ label: "X", href: "#jonas-x" },
{ label: "Website", href: "#jonas-site" },
{ label: "Mastodon", href: "#jonas-mastodon" },
{ label: "Bluesky", href: "#jonas-bluesky" },
{ label: "Email", href: "mailto:jonas@example.com", icon: Mail },
{ label: "Portfolio", href: "#jonas-portfolio", icon: Globe },
{ label: "RSS", href: "#jonas-rss", icon: Rss },
]}
/>
</div>
</div>
```
### On an author page
headingTag="h1": the box opens the page. A link without an icon shows as a text link.
```astro
---
import Mail from "@lucide/astro/icons/mail";
import AuthorBox from "@astronomic-dev/ui/components/AuthorBox.astro";
// Your own photo.
import lena from "../../photos/portrait-glasses.webp";
---
<!-- On an author page the box opens the page, so its name is the h1. -->
<div class="mx-auto max-w-3xl">
<AuthorBox
headingTag="h1"
name="Lena Ruiz"
role="Designer"
bio="Lena designs the pages and the type, and writes the journal's notes on fonts, color and the small decisions that make a site read well."
image={{ src: lena }}
links={[
{ label: "Email", href: "mailto:lena@example.com", icon: Mail },
{ label: "Website", href: "#lena-site" },
]}
/>
</div>
```
## Props
### AuthorBox
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | None | Required. The writer's name: the section's heading. A long word breaks inside the box. |
| `role` | `string` | None | Their role, such as "Editor · Food", small and muted under the name. |
| `bio` | `string` | None | A few sentences about them, muted, at the running-text width. |
| `bioClass` | `string` | None | Classes for the bio, after its own, so yours win: such as your theme's darker body color. |
| `image` | `DecorativeImage` | None | Their photo, { src, width?, height? }, as decoration: the part writes alt="", since the name is beside it. Without it, their initials. |
| `links` | `TeamLink[]` | `[]` | Their links, { label, href, icon? } (TeamLink). With an icon, a round button with the icon only; without, a text link. Each is read as "<name> on <label>". |
| `viewAll` | `PostsLink` | None | A link to all their posts, { label, href }, such as { label: "All posts by Ada", href }. It comes first in the row. |
| `headingTag` | `"h1" \| "h2" \| "h3" \| "h4"` | `"h2"` | The name's element. h1 on an author page. |
| `class` | `string` | None | More classes for the <section>, merged with cn(). The section is a named size container (author). |
Any other attribute goes on the <section>. The role attribute is left out: role is the writer's job here.
## Accessibility
- Renders a <section> named by the writer's name, so it is a region landmark.
- The photo is decorative: the name is right beside it.
- Each icon link is read with the writer's name, e.g. "Ada Brook on Email"; a text link too.
- On touch screens every link (the round icon links, the all-posts link and the text links) is a box of 44px at least, so when the links wrap no two hit areas overlap.
AuthorBox
FreeAt the end of a post or on an author page: the writer's photo, name, role, a short bio and their links.
- File
- AuthorBox.astro
- Group
- Data display
- Kind
- Static: no JavaScript
- Examples
- 4
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
At the end of a post
From a 28rem box the 6rem photo sits beside the text: the name, the role, the bio, then the all-posts link and the icon links as round buttons.
In a side column
In a 16rem column the photo (4rem) sits above the name; the same part, sized by its own box.
Many links
Seven links in a 16rem column: the text links (one a single letter) and the round icon links wrap to several rows. On a touch screen each link is a 44px box, so no two overlap.
On an author page
headingTag="h1": the box opens the page. A link without an icon shows as a text link.
Minimal · Light