1 GitHub star = 1 new component.

Law Firm

Law FAQ

Frequently asked questions as a native accordion with a contact line.

lawlegalfaqaccordion
Live Preview

Preguntas frecuentes

¿La primera consulta tiene coste?

La primera consulta de 30 minutos es gratuita y sin compromiso. Si decides contratarnos, te enviamos una hoja de encargo con el presupuesto.

¿Cuánto tardáis en responder?

Respondemos cualquier mensaje del portal en menos de 24 horas laborables, y en urgencias penales atendemos las 24 horas.

¿Mis documentos están seguros?

Sí. El portal cifra los documentos y solo accedes tú y tu equipo jurídico. Cumplimos el secreto profesional y el RGPD.

¿Puedo llevar mi caso a distancia?

Sí. Puedes hacer consultas por videollamada, firmar con firma electrónica y seguir todo el expediente desde el portal.

¿No encuentras tu duda? Escríbenos y te respondemos en menos de 24 horas. Contactar

Usage

Copy and paste this code into your Astro page:

astro
---
import { LawFaq } from 'astro-component-kit/sections';
---

<LawFaq faqs={lawFaqs} />
--- import { LawFaq } from 'astro-component-kit/sections'; --- <LawFaq faqs={lawFaqs} />

Examples in context

Real code from the kit: how this piece is used inside templates, sections and other components.

Template Fuero · Law Firm & Client Portal LawAreasPage.astro
astro
<LawFaq faqs={data.faqs} />
<LawFaq faqs={data.faqs} />

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/sections/LawFAQ.astro:

astro
---
/**
 * LawFaq — Frequently asked questions as a native accordion with an optional "open all"
 * control and a contact line.
 *
 * @param {LawFaq[]} faqs - Questions and answers.
 * @param {string} title - Section heading.
 * @param {string} contactText - Line under the list.
 * @param {string} contactHref - Link of the contact line.
 * @param {string} headingLevel - 'h1' | 'h2'. Default 'h2'.
 * @param {string} class - Extra class for the root.
 *
 * Accessibility: native <details>/<summary>; summary targets are 56px tall with a visible focus ring.
 */
import type { HTMLAttributes } from 'astro/types';
import '../templates/law-firm/law-theme.css';
import { lawFaqs, type LawFaq } from '../templates/law-firm/data';

interface OwnProps {
  faqs?: LawFaq[];
  title?: string;
  contactText?: string;
  contactHref?: string;
  headingLevel?: 'h1' | 'h2';
}

type Props = OwnProps & Omit<HTMLAttributes<'section'>, keyof OwnProps | 'class'> & { class?: string };

const {
  faqs = lawFaqs,
  title = 'Preguntas frecuentes',
  contactText = '¿No encuentras tu duda? Escríbenos y te respondemos en menos de 24 horas.',
  contactHref = 'mailto:consultas@fuero.example',
  headingLevel = 'h2',
  class: classAttr,
  ...rest
} = Astro.props;

const Heading = headingLevel;
const uid = `bq-${Math.random().toString(36).slice(2, 8)}`;
---

<section class:list={['law-ui', 'law-faq', classAttr]} aria-labelledby={`${uid}-title`} {...rest}>
  <div class="law-faq__inner">
    <Heading id={`${uid}-title`} class="law-faq__title">{title}</Heading>
    <div class="law-faq__list">
      {faqs.map((f) => (
        <details class="law-faq__item">
          <summary>{f.q}</summary>
          <p>{f.a}</p>
        </details>
      ))}
    </div>
    <p class="law-faq__contact">{contactText} <a href={contactHref}>Contactar</a></p>
  </div>
</section>

<style>
  .law-faq {
    padding: var(--sp-12, 3rem) var(--sp-4, 1rem);
    background: var(--lw-bg);
    color: var(--lw-text);
    font-family: var(--lw-font-body);
  }

  .law-faq__inner {
    max-width: 820px;
    margin: 0 auto;
  }

  .law-faq__title {
    margin: 0 0 var(--sp-6, 1.5rem);
    font-family: var(--lw-font-display);
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    line-height: 1;
  }

  .law-faq__list {
    border-top: 1px solid var(--lw-border);
  }

  .law-faq__item {
    border-bottom: 1px solid var(--lw-border);
  }

  .law-faq__item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3, 0.75rem);
    min-height: 60px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
  }

  .law-faq__item summary::-webkit-details-marker {
    display: none;
  }

  .law-faq__item summary::after {
    content: '+';
    color: var(--lw-brand);
    font-size: 1.6rem;
    font-weight: 400;
    transition: transform 0.2s ease;
  }

  .law-faq__item[open] summary::after {
    transform: rotate(45deg);
  }

  .law-faq__item summary:focus-visible,
  .law-faq__contact a:focus-visible {
    outline: 2px solid var(--lw-brand);
    outline-offset: 2px;
  }

  .law-faq__item p {
    margin: 0 0 var(--sp-4, 1rem);
    color: var(--lw-text-2);
    line-height: 1.65;
  }

  .law-faq__contact {
    margin: var(--sp-6, 1.5rem) 0 0;
    color: var(--lw-text-2);
  }

  .law-faq__contact a {
    color: var(--lw-brand);
    font-weight: 700;
  }

  @media (prefers-reduced-motion: reduce) {
    .law-faq__item summary::after {
      transition: none;
    }
  }
</style>
--- /** * LawFaq — Frequently asked questions as a native accordion with an optional "open all" * control and a contact line. * * @param {LawFaq[]} faqs - Questions and answers. * @param {string} title - Section heading. * @param {string} contactText - Line under the list. * @param {string} contactHref - Link of the contact line. * @param {string} headingLevel - 'h1' | 'h2'. Default 'h2'. * @param {string} class - Extra class for the root. * * Accessibility: native <details>/<summary>; summary targets are 56px tall with a visible focus ring. */ import type { HTMLAttributes } from 'astro/types'; import '../templates/law-firm/law-theme.css'; import { lawFaqs, type LawFaq } from '../templates/law-firm/data'; interface OwnProps { faqs?: LawFaq[]; title?: string; contactText?: string; contactHref?: string; headingLevel?: 'h1' | 'h2'; } type Props = OwnProps & Omit<HTMLAttributes<'section'>, keyof OwnProps | 'class'> & { class?: string }; const { faqs = lawFaqs, title = 'Preguntas frecuentes', contactText = '¿No encuentras tu duda? Escríbenos y te respondemos en menos de 24 horas.', contactHref = 'mailto:consultas@fuero.example', headingLevel = 'h2', class: classAttr, ...rest } = Astro.props; const Heading = headingLevel; const uid = `bq-${Math.random().toString(36).slice(2, 8)}`; --- <section class:list={['law-ui', 'law-faq', classAttr]} aria-labelledby={`${uid}-title`} {...rest}> <div class="law-faq__inner"> <Heading id={`${uid}-title`} class="law-faq__title">{title}</Heading> <div class="law-faq__list"> {faqs.map((f) => ( <details class="law-faq__item"> <summary>{f.q}</summary> <p>{f.a}</p> </details> ))} </div> <p class="law-faq__contact">{contactText} <a href={contactHref}>Contactar</a></p> </div> </section> <style> .law-faq { padding: var(--sp-12, 3rem) var(--sp-4, 1rem); background: var(--lw-bg); color: var(--lw-text); font-family: var(--lw-font-body); } .law-faq__inner { max-width: 820px; margin: 0 auto; } .law-faq__title { margin: 0 0 var(--sp-6, 1.5rem); font-family: var(--lw-font-display); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; } .law-faq__list { border-top: 1px solid var(--lw-border); } .law-faq__item { border-bottom: 1px solid var(--lw-border); } .law-faq__item summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3, 0.75rem); min-height: 60px; font-weight: 700; cursor: pointer; list-style: none; } .law-faq__item summary::-webkit-details-marker { display: none; } .law-faq__item summary::after { content: '+'; color: var(--lw-brand); font-size: 1.6rem; font-weight: 400; transition: transform 0.2s ease; } .law-faq__item[open] summary::after { transform: rotate(45deg); } .law-faq__item summary:focus-visible, .law-faq__contact a:focus-visible { outline: 2px solid var(--lw-brand); outline-offset: 2px; } .law-faq__item p { margin: 0 0 var(--sp-4, 1rem); color: var(--lw-text-2); line-height: 1.65; } .law-faq__contact { margin: var(--sp-6, 1.5rem) 0 0; color: var(--lw-text-2); } .law-faq__contact a { color: var(--lw-brand); font-weight: 700; } @media (prefers-reduced-motion: reduce) { .law-faq__item summary::after { transition: none; } } </style>
Part of a complete template

This section was crafted as a core block for the following template. You can preview the full interactive multi-page experience or explore all related components.

Full templates 9 pages · 20 components

Fuero · Law Firm & Client Portal

Law firm site with practice areas, team, fee models and consultation booking, plus a client portal with cases and timelines, documents with e-signature, secure messages, appointments and invoices.

More Sections to Explore

Discover other full-width landing blocks and production-ready sections from our library.

All sections