Data displayCredentialsList
Searchastronomic.dev# CredentialsList
To build your own list of licenses, insurance and warranties: each row shows only when it is filled.
Static: no JavaScript.
## Usage
```astro
import CredentialsList from "@astronomic-dev/ui/components/CredentialsList.astro";
```
## Examples
### Your own layout
The shell with your classes: rows stacked with a gap, the marker before each term. The empty Bonded row is left out.
```astro
---
import CredentialsList from "@astronomic-dev/ui/components/CredentialsList.astro";
import BadgeCheck from "@lucide/astro/icons/badge-check";
import { plumbing } from "../_data/groundcrew.ts";
// The shell with your own layout: the rows stacked with a gap, the marker before each term. A row with no detail is
// left out, so the empty "Bonded" line never shows.
const items = [
...plumbing.credentials.map(({ label, value }) => ({ term: label, detail: value })),
{ term: "Bonded", detail: "" },
];
---
<!-- Brassfield Plumbing & Drain's credentials, in a layout of your own. -->
<CredentialsList
items={items}
marker={BadgeCheck}
class="gap-4"
itemClass="grid gap-1"
termClass="inline-flex items-center gap-2"
markerClass="inline-flex text-accent normal-case"
/>
```
## Props
### CredentialsList
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `CredentialItem[]` | `[]` | Required. Each row: { term, detail?, note?, icon? }. term is the label, such as "License"; detail the value, such as "Sample license OH PL.000000"; note a quieter line under it; icon your icon component for that row's marker. A row shows only with its term and its detail; with none filled, nothing renders. |
| `marker` | `IconComponent` | None | Your icon component, the marker on every row (a row's own icon wins). Decoration, hidden from a screen reader. |
| `itemClass` | `string` | None | For recipes. More classes for each row's <div>. |
| `termClass` | `string` | None | For recipes. More classes for each term (the <dt>). |
| `detailClass` | `string` | None | For recipes. More classes for each detail (the <dd>, which holds the note). |
| `markerClass` | `string` | None | For recipes. Classes for each marker's span, inside the <dt>. |
| `class` | `string` | None | More classes for the <dl>, merged with cn(), so yours win on conflicts. |
Any other attribute goes on the <dl>.
## Accessibility
- A description list: a screen reader says each term with its detail, and how many rows there are.
- Only filled rows render, so a missing license or warranty never leaves an empty term.
- The marker is decoration, hidden from a screen reader: the term says what the row is.
- The note is never hidden at a narrow width; it wraps.
CredentialsList
FreeTo build your own list of licenses, insurance and warranties: each row shows only when it is filled.
- File
- CredentialsList.astro
- Group
- Data display
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Your own layout
The shell with your classes: rows stacked with a gap, the marker before each term. The empty Bonded row is left out.
- License
- Sample license OH PL.000000
- Insurance
- General liability and workers' comp
- Warranty
- 1 year on labor
Force statemain.astro
examples/credentialslist/main.astro
---
import CredentialsList from "@astronomic-dev/ui/components/CredentialsList.astro";
import BadgeCheck from "@lucide/astro/icons/badge-check";
import { plumbing } from "../_data/groundcrew.ts";
// The shell with your own layout: the rows stacked with a gap, the marker before each term. A row with no detail is
// left out, so the empty "Bonded" line never shows.
const items = [
...plumbing.credentials.map(({ label, value }) => ({ term: label, detail: value })),
{ term: "Bonded", detail: "" },
];
---
<!-- Brassfield Plumbing & Drain's credentials, in a layout of your own. -->
<CredentialsList
items={items}
marker={BadgeCheck}
class="gap-4"
itemClass="grid gap-1"
termClass="inline-flex items-center gap-2"
markerClass="inline-flex text-accent normal-case"
/>Minimal · Light