NavigationAreaChips
Searchastronomic.dev# AreaChips
For the towns you serve as a row of links, each to its own page.
Static: no JavaScript.
## Usage
```astro
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
```
## Examples
### Towns with their pages
Each town a pill link to its own page, your pin before it, the home town tagged. The chips wrap, never scroll.
```astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { plumbing } from "../_data/groundcrew.ts";
const items = plumbing.areas.map((area, i) => ({
label: area.name,
href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}`,
note: i === 0 ? "Home base" : undefined,
}));
---
<!-- Brassfield Plumbing & Drain's towns, each a link to its own page. -->
<AreaChips items={items} icon={MapPin} />
```
### Area pages off
Without an href a town shows as text in the same pill.
```astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { cleaning } from "../_data/groundcrew.ts";
---
<!-- Area pages off: with no href each town shows as text, in the same pill. -->
<AreaChips items={cleaning.areas.map((area) => ({ label: area.name }))} label="Towns Tidewell Home Cleaning serves" icon={MapPin} />
```
### On a town's page
current on the town you are on: aria-current="page" and the inverted look, so the list shows where you are.
```astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { plumbing } from "../_data/groundcrew.ts";
// The page you are on: the second town's own page.
const items = plumbing.areas.map((area, i) => ({
label: area.name,
href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}`,
note: i === 0 ? "Home base" : undefined,
current: i === 1,
}));
---
<!-- On a town's own page: the town you are on carries aria-current="page" and the inverted look. -->
<AreaChips items={items} icon={MapPin} />
```
### On the band
tone="band": the band's own text, rules and focus ring.
```astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { landscaping } from "../_data/groundcrew.ts";
const items = landscaping.areas.map((area) => ({ label: area.name, href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}` }));
---
<!-- On the band: the chips take the band's own text and rules, and its focus ring. -->
<div class="surface-band rounded-card p-6">
<AreaChips items={items} tone="band" icon={MapPin} />
</div>
```
## Props
### AreaChips
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `AreaChip[]` | `[]` | Required. Each town: { label, href?, note?, current? }. label is the town, href its own page (without it the town is text), note a small tag such as "Home base", current true on the town whose page this is (aria-current="page", its colors swapped, the text color as the fill and the surface as the text, after itemClass). A town with no label is left out; with none, nothing renders. |
| `label` | `string` | `"Towns we serve"` | The list's accessible name. |
| `icon` | `IconComponent` | None | Your icon component (a map pin), before each town. Decoration. |
| `tone` | `"page" \| "band"` | `"page"` | page: the card surface on the page or a card. band: on the band (surface-band), in the band's own colors with its focus ring. |
| `itemClass` | `string` | None | More classes for each chip (the link, or the text). |
| `class` | `string` | None | More classes for the <ul>, merged with cn(), so yours win on conflicts. |
Any other attribute goes on the <ul>.
## Accessibility
- A list named by its label (role="list" keeps it one in Safari when the bullets are gone), so a screen reader says how many towns there are.
- Each chip is at least 44px tall at every pointer.
- The pin is decoration, hidden from a screen reader; the note is read as part of the link.
- A town without its own page is plain text, not a link that goes nowhere.
- The current town carries aria-current="page", so a screen reader says it is the page you are on; the inverted fill shows it without color alone.
AreaChips
FreeFor the towns you serve as a row of links, each to its own page.
- File
- AreaChips.astro
- Group
- Navigation
- Kind
- Static: no JavaScript
- Examples
- 4
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Towns with their pages
Each town a pill link to its own page, your pin before it, the home town tagged. The chips wrap, never scroll.
examples/areachips/main.astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { plumbing } from "../_data/groundcrew.ts";
const items = plumbing.areas.map((area, i) => ({
label: area.name,
href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}`,
note: i === 0 ? "Home base" : undefined,
}));
---
<!-- Brassfield Plumbing & Drain's towns, each a link to its own page. -->
<AreaChips items={items} icon={MapPin} />Area pages off
Without an href a town shows as text in the same pill.
- Gilbert
- Mesa
- Chandler
- Tempe
- Queen Creek
Force stateno-links.astro
examples/areachips/no-links.astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { cleaning } from "../_data/groundcrew.ts";
---
<!-- Area pages off: with no href each town shows as text, in the same pill. -->
<AreaChips items={cleaning.areas.map((area) => ({ label: area.name }))} label="Towns Tidewell Home Cleaning serves" icon={MapPin} />On a town's page
current on the town you are on: aria-current="page" and the inverted look, so the list shows where you are.
examples/areachips/current.astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { plumbing } from "../_data/groundcrew.ts";
// The page you are on: the second town's own page.
const items = plumbing.areas.map((area, i) => ({
label: area.name,
href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}`,
note: i === 0 ? "Home base" : undefined,
current: i === 1,
}));
---
<!-- On a town's own page: the town you are on carries aria-current="page" and the inverted look. -->
<AreaChips items={items} icon={MapPin} />On the band
tone="band": the band's own text, rules and focus ring.
examples/areachips/band.astro
---
import AreaChips from "@astronomic-dev/ui/components/AreaChips.astro";
import MapPin from "@lucide/astro/icons/map-pin";
import { landscaping } from "../_data/groundcrew.ts";
const items = landscaping.areas.map((area) => ({ label: area.name, href: `#areas-${area.name.toLowerCase().replaceAll(" ", "-")}` }));
---
<!-- On the band: the chips take the band's own text and rules, and its focus ring. -->
<div class="surface-band rounded-card p-6">
<AreaChips items={items} tone="band" icon={MapPin} />
</div>Minimal · Light