src/components/list/ListFilter.astro
---
interface Props {
items: Array<{ tag: string; label: string }>;
}
const { items = [
{ tag: "alle", label: "Alles" },
{ tag: "ads", label: "Advertenties" },
{ tag: "seo", label: "SEO" },
{ tag: "social", label: "Social" },
{ tag: "content", label: "Content" },
{ tag: "web", label: "Webdesign" },
] } = Astro.props;
---
<div class="lst-fil">
{items.map((item, i) => (
<label class="lst-fil__option">
<input type="radio" name="lst-filter" value={item.tag} class="lst-fil__radio" checked={i === 0} />
<span class="lst-fil__label">{item.label}</span>
</label>
))}
</div>
<style>
:root {
--color-accent: #6366f1;
--color-primary: #0a0a0a;
}
.lst-fil {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.lst-fil__radio { display: none; }
.lst-fil__label {
display: inline-block;
padding: 0.4rem 0.9rem;
border-radius: 999px;
font-size: 0.875rem;
font-weight: 600;
border: 1.5px solid #e0e0e0;
color: #555;
cursor: pointer;
transition: all 0.2s;
}
.lst-fil__label:hover {
border-color: var(--color-accent);
color: var(--color-accent);
}
.lst-fil__radio:checked + .lst-fil__label {
background: var(--color-accent);
border-color: var(--color-accent);
color: #fff;
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
items * | { tag: string; label: string }[] | — | Filteropties |
* = verplicht