# Split FAQ with a contact card (左右分栏的常见问题与联系卡片)

Business banking FAQ: heading and a human contact card stay on the left while an accordion of questions scrolls on the right. Supports optional topic groups.

- Ref: `component/faq-split` (component · faq)
- Page: https://uifino.com/en/components/faq/faq-split
- Markdown: https://uifino.com/md/components/faq-split.md
- Preview image: https://uifino.com/blocks/covers/faq-split-dark.webp

## Install

- shadcn: `npx shadcn@latest add "https://uifino.com/r/blocks/faq-split.json"`
- UIFino CLI: `npx uifino@latest add component/faq-split`

## Dependencies

`lucide-react`

## shadcn/ui components it builds on

- `accordion`, `button`, `separator`. The shadcn CLI installs them together with the block.

## Layout borrowed from

- https://linear.app/pricing: Borrowed the split layout: heading column on the left, hairline-divided question list on the right. Questions, contact card and copy are our own.

## Theme

The block reads the project's shadcn theme variables, so it follows whatever DESIGN.md the project uses and needs no options of its own.
To give the project the look of a UIFino brand or style, install its theme: `npx shadcn@latest add "https://uifino.com/r/themes/mercury.json"`.

## Usage

The files under `examples/` show the block wired with content, including its loading, empty and error states where it has them.

## Files

| Path | Role | Size |
| :--- | :--- | ---: |
| components/blocks/faq-split/examples/content.ts | demo | 7.6 KB |
| components/blocks/faq-split/examples/default.tsx | demo | 405 B |
| components/blocks/faq-split/examples/grouped.tsx | demo | 963 B |
| components/blocks/faq-split/faq-split.tsx | source | 4.0 KB |

### components/blocks/faq-split/faq-split.tsx

```tsx
import { Clock, Mail, Phone } from "lucide-react";
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger
} from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";

export interface FaqEntry {
  readonly id: string;
  readonly question: string;
  readonly answer: string;
}

export interface FaqGroup {
  readonly id: string;
  readonly label?: string;
  readonly entries: readonly FaqEntry[];
}

export interface FaqContact {
  readonly title: string;
  readonly phone: string;
  readonly email: string;
  readonly hours: string;
  readonly actionLabel: string;
  readonly href: string;
}

export interface FaqSplitProps {
  readonly title: string;
  readonly description?: string;
  readonly groups: readonly FaqGroup[];
  readonly contact: FaqContact;
  readonly defaultOpen?: string;
}

const linkClass =
  "min-w-0 truncate rounded-sm text-foreground outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50";

export function FaqSplit({ title, description, groups, contact, defaultOpen }: FaqSplitProps) {
  return (
    <section className="@container bg-background text-foreground">
      <div className="mx-auto grid w-full max-w-6xl gap-10 px-4 py-16 @3xl:px-8 @3xl:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] @3xl:gap-16 @3xl:py-24">
        <div className="flex flex-col gap-8 @3xl:sticky @3xl:top-24 @3xl:self-start">
          <div className="flex flex-col gap-3">
            <h2 className="font-heading text-3xl font-semibold tracking-tight text-balance @3xl:text-4xl">{title}</h2>
            {description ? (
              <p className="max-w-md text-base text-pretty text-muted-foreground">{description}</p>
            ) : null}
          </div>
          <div className="flex max-w-md flex-col gap-4 rounded-xl border bg-card p-5 text-card-foreground">
            <p className="font-medium">{contact.title}</p>
            <ul className="flex flex-col gap-2.5 text-sm text-muted-foreground">
              <li className="flex items-center gap-2.5">
                <Phone className="size-4 shrink-0" aria-hidden="true" />
                <a href={`tel:${contact.phone.replace(/[^\d+]/g, "")}`} className={linkClass}>
                  {contact.phone}
                </a>
              </li>
              <li className="flex items-center gap-2.5">
                <Mail className="size-4 shrink-0" aria-hidden="true" />
                <a href={`mailto:${contact.email}`} className={linkClass}>
                  {contact.email}
                </a>
              </li>
              <li className="flex items-center gap-2.5">
                <Clock className="size-4 shrink-0" aria-hidden="true" />
                <span className="min-w-0">{contact.hours}</span>
              </li>
            </ul>
            <Separator />
            <Button asChild className="w-full">
              <a href={contact.href}>{contact.actionLabel}</a>
            </Button>
          </div>
        </div>
        <Accordion type="single" collapsible defaultValue={defaultOpen} className="min-w-0">
          {groups.map((group) => (
            <div key={group.id} className="flex flex-col gap-2 not-first:mt-10">
              {group.label ? <h3 className="text-sm font-medium text-muted-foreground">{group.label}</h3> : null}
              <div className="border-t">
                {group.entries.map((entry) => (
                  <AccordionItem key={entry.id} value={entry.id}>
                    <AccordionTrigger className="py-5 text-base font-medium text-balance hover:no-underline">
                      {entry.question}
                    </AccordionTrigger>
                    <AccordionContent className="max-w-prose text-base text-muted-foreground">
                      {entry.answer}
                    </AccordionContent>
                  </AccordionItem>
                ))}
              </div>
            </div>
          ))}
        </Accordion>
      </div>
    </section>
  );
}
```

Not inlined (3 files, 9.0 KB). Full sources: https://uifino.com/r/blocks/faq-split.json
