Zoeken...  ⌘K GitHub

FormReview Forms

Reviewformulier met sterbeoordeling, titel, vrije tekst en waardering-tags.

/form-review
src/components/forms/FormReview.astro
---
/**
 * FormReview — reviewformulier met sterren, titel, tekst en waardering-tags.
 *
 * Props:
 * - heading?: string
 * - sub?: string
 * - ratingLabel?: string
 * - highlights?: string[]
 * - submitLabel?: string
 */
interface Props {
  heading?: string;
  sub?: string;
  ratingLabel?: string;
  highlights?: string[];
  submitLabel?: string;
}
const {
  heading = 'Laat een review achter',
  sub = 'Jouw eerlijke mening helpt andere bedrijven een weloverwogen keuze te maken.',
  ratingLabel = 'Jouw beoordeling *',
  highlights = ['Communicatie', 'Resultaten', 'Snelheid', 'Creativiteit', 'Kennis & expertise', 'Transparantie', 'Prijs-kwaliteit'],
  submitLabel = 'Review plaatsen',
} = Astro.props;
const stars = [5, 4, 3, 2, 1];
---

<section class="bl-section frv">
  <div class="bl-inner bl-inner--narrow frv-inner">
    <div class="frv-header">
      <h2 class="frv-heading">{heading}</h2>
      <p class="frv-subtext">{sub}</p>
    </div>
    <form class="frv-form" novalidate>
      <div class="frv-stars-field">
        <span class="frv-label">{ratingLabel}</span>
        <div class="frv-stars" role="group" aria-label="Sterren beoordeling">
          {stars.map((n) => (
            <label class="frv-star" aria-label={`${n} ${n === 1 ? 'ster' : 'sterren'}`}>
              <input class="frv-star-input" type="radio" name="rating" value={String(n)} required />
              <span class="frv-star-icon" aria-hidden="true">★</span>
            </label>
          ))}
        </div>
      </div>
      <div class="frv-row">
        <div class="frv-field">
          <label class="frv-label" for="frv-name">Naam *</label>
          <input class="frv-input" type="text" id="frv-name" name="name" placeholder="Jouw naam" required autocomplete="name" />
        </div>
        <div class="frv-field">
          <label class="frv-label" for="frv-company">Bedrijf</label>
          <input class="frv-input" type="text" id="frv-company" name="company" placeholder="Bedrijfsnaam" autocomplete="organization" />
        </div>
      </div>
      <div class="frv-field">
        <label class="frv-label" for="frv-title">Titel van je review *</label>
        <input class="frv-input" type="text" id="frv-title" name="title" placeholder="Bijv. Uitstekende samenwerking" required />
      </div>
      <div class="frv-field">
        <label class="frv-label" for="frv-review">Jouw review *</label>
        <textarea class="frv-textarea" id="frv-review" name="review" rows="5" placeholder="Deel jouw ervaring. Wat heeft je het meest geholpen?" required></textarea>
        <span class="frv-hint">Minimaal 50 tekens voor een goede review.</span>
      </div>
      <div class="frv-field">
        <label class="frv-label">Wat waardeer je het meest?</label>
        <div class="frv-tags">
          {highlights.map((h) => (
            <label class="frv-tag-item">
              <input class="frv-tag-check" type="checkbox" name="highlights" value={h} />
              <span>{h}</span>
            </label>
          ))}
        </div>
      </div>
      <label class="frv-check-label">
        <input class="frv-check" type="checkbox" name="public_consent" required />
        Ik geef toestemming om deze review publiek te plaatsen
      </label>
      <button class="frv-submit" type="submit">{submitLabel}</button>
    </form>
  </div>
</section>

<style>
.frv-header{margin-bottom:1.75rem}
.frv-heading{font-size:1.75rem;font-weight:800;color:var(--color-primary, #0a0a0a);margin:0 0 .5rem}
.frv-subtext{font-size:1rem;color:#555;margin:0;line-height:1.6}
.frv-form{display:flex;flex-direction:column;gap:1.25rem}
.frv-stars-field{display:flex;flex-direction:column;gap:.5rem}
.frv-label{font-size:.95rem;font-weight:600;color:var(--color-primary, #0a0a0a)}
.frv-stars{display:flex;flex-direction:row-reverse;justify-content:flex-end;gap:.25rem;width:fit-content}
.frv-star{cursor:pointer}
.frv-star-input{display:none}
.frv-star-icon{font-size:2rem;color:#d4d4d4;transition:color .1s;display:block}
.frv-star:hover .frv-star-icon,.frv-star:hover~.frv-star .frv-star-icon{color:#f59e0b}
.frv-star-input:checked~.frv-star .frv-star-icon,.frv-star:has(.frv-star-input:checked) .frv-star-icon{color:#f59e0b}
.frv-row{display:grid;grid-template-columns:1fr;gap:1.25rem}
.frv-field{display:flex;flex-direction:column;gap:.4rem}
.frv-input,.frv-textarea{padding:.7rem .9rem;border:1.5px solid #ddd;border-radius:8px;font-size:1rem;color:var(--color-primary, #0a0a0a);background:#fff;transition:border-color .2s;font-family:inherit;box-sizing:border-box;width:100%}
.frv-input:focus,.frv-textarea:focus{outline:none;border-color:var(--color-accent, #6366f1);box-shadow:0 0 0 3px #6366f11f}
.frv-textarea{resize:vertical;min-height:120px}
.frv-hint{font-size:.8125rem;color:#555}
.frv-tags{display:flex;flex-wrap:wrap;gap:.5rem}
.frv-tag-item{display:flex;align-items:center;gap:.4rem;padding:.45rem .95rem;background:#f5f5f5;border-radius:20px;font-size:.9375rem;color:#374151;cursor:pointer;border:1.5px solid transparent;transition:border-color .15s,background-color .15s,color .15s}
.frv-tag-item:has(input:checked){background:#eef2ff;color:var(--color-accent, #6366f1);border-color:var(--color-accent, #6366f1)}
.frv-tag-check{display:none}
.frv-check-label{display:flex;align-items:flex-start;gap:.5rem;font-size:.9rem;color:#374151;cursor:pointer}
.frv-check{accent-color:var(--color-accent, #6366f1);flex-shrink:0;margin-top:2px}
.frv-submit{padding:.9rem 2rem;background:var(--color-accent, #6366f1);color:#fff;border:none;border-radius:8px;font-size:1rem;font-weight:600;cursor:pointer;transition:opacity .2s;align-self:flex-start}
.frv-submit:hover{opacity:.88}
@media(min-width:600px){.frv-row{grid-template-columns:1fr 1fr}}
</style>

Props

Prop Type Default Beschrijving
heading string 'Laat een review achter' Kop boven het formulier
sub string - Toelichtende tekst onder de kop
ratingLabel string 'Jouw beoordeling *' Label boven de sterren
highlights string[] - Selecteerbare waardering-tags
submitLabel string 'Review plaatsen' Tekst op de submit-knop

* = verplicht