FAQ widget
The complete guide to the WidgetCore FAQ widget — question and answer items, accordion or toggle mode, icons, animation speed, question heading tag, FAQPage schema and styling.
The FAQ widget is an accessible accordion: every question is a button inside a heading tag, and every answer is a region connected to that button with aria-labelledby. Alongside the widget, FAQPage structured data is printed.
| Item | Value |
|---|---|
| Widget name | wgcr-faq |
| Panel title | FAQ |
| Category | WidgetCore Widgets (wgcr) |
| Style / script | wgcr-faq |
| Root class | .wgcr-faq |
The “Questions” section
The only control here is a repeater called Items with three fields:
| Field | Type | Default | Notes |
|---|---|---|---|
| Question title | Text | “Question title” | The text on the button, and the value used for Question.name in the schema |
| Answer | WYSIWYG | “Answer text…” | The answer content; links and simple formatting are allowed |
| Open by default | Switcher | No | When on, this item starts open |
On first use the widget is filled with a few sample items so you can see the structure; replace all of their text with your own content.
The “Behaviour” section
| Control | Type | Values | Default |
|---|---|---|---|
| Open mode | Select | Accordion (only one item open) / Toggle (several items at once) | Accordion |
| Icon | Select | Plus / Chevron / Custom (Elementor icon library) | Plus |
| Custom icon | Icon | From the Elementor icon library | — |
| Animation speed (ms) | Slider | 100 to 1000 | 300 |
Accordion mode: opening an item closes the previously open one. Better for long lists and mobile screens.
Toggle mode: every item opens and closes independently, so visitors can keep several answers open at once; better for comparing questions.
Icons are inline SVG elements colored with currentColor, so they follow the color controls in the “Icon” section. In the open state the plus icon rotates 45 degrees and the chevron and custom icons rotate 180 degrees; the rotation of a custom icon is adjustable with “Custom icon rotation when open (deg)”.
The “SEO and structure” section
| Control | Values | Default | Notes |
|---|---|---|---|
| Question heading tag | H2 / H3 (recommended) / H4 / DIV | H3 | Defines the heading structure of your page |
| FAQ schema (JSON-LD) | Yes / No | Yes | Prints FAQPage structured data for search engines |
Shape of the structured data output
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "How are the courses delivered?",
"acceptedAnswer": {
"@type": "Answer",
"text": "All courses are video-based and online…"
}
}
]
}
The output is printed with JSON_UNESCAPED_UNICODE, so non-Latin text stays readable in the page source instead of becoming \uXXXX sequences.
Without JavaScript
FAQ interaction requires JavaScript; there is no details/summary fallback. Closed answers remain hidden (max-height: 0). Only initially open answers remain visible, with a 640px CSS cap, so long answers can be clipped. Provide essential information outside the accordion when no-script access is required.
HTML output structure
<div class="wgcr-faq" data-mode="accordion" data-speed="300">
<div class="wgcr-faq-list">
<div class="wgcr-faq-item open" data-icon="plus">
<h3 class="wgcr-faq-qwrap">
<button type="button" class="wgcr-faq-q" id="wgcr-faq-q-abc123-0"
aria-expanded="true" aria-controls="wgcr-faq-a-abc123-0">
<span class="wgcr-faq-qtext">Question title</span>
<span class="wgcr-faq-ic"><svg viewBox="0 0 24 24" aria-hidden="true">…</svg></span>
</button>
</h3>
<div class="wgcr-faq-a" role="region" id="wgcr-faq-a-abc123-0"
aria-labelledby="wgcr-faq-q-abc123-0">
<div class="wgcr-faq-atext">Answer text…</div>
</div>
</div>
</div>
</div>
| Class | Role |
|---|---|
.wgcr-faq | Root; carries data-mode and data-speed |
.wgcr-faq-list | The grid of items with an adjustable gap |
.wgcr-faq-item | Each card; gets the open class when expanded |
.wgcr-faq-qwrap | The heading tag (per the “Question heading tag” control) |
.wgcr-faq-q | The question button; the keyboard focus target |
.wgcr-faq-qtext | The question text (supports inline editing) |
.wgcr-faq-ic | The icon box |
.wgcr-faq-a | The answer region with role="region" |
.wgcr-faq-atext | The answer text |
Accessibility and keyboard
| Key | Behaviour |
|---|---|
Enter or Space | Opens or closes the focused question |
ArrowDown | Moves to the next question |
ArrowUp | Moves to the previous question |
Home | First question |
End | Last question |
- Closed answers leave the tab order (through
visibility: hidden), so keyboard users never get trapped inside hidden content. - The focus ring is only painted for
:focus-visible, so mouse clicks do not draw a blue outline. - When the visitor enabled
prefers-reduced-motion, animation is removed and items open instantly. - The height of each open answer is measured dynamically and re-measured when the window is resized, so long answers are never clipped.
- Movement between questions wraps around: after the last question,
ArrowDownreturns to the first.
More detail on the accessibility and keyboard shortcuts pages.
Style sections
Size controls here (width, gaps, radius, padding, icon sizes) have a device switcher and Normal/Hover tabs — see Responsive sizes and hover.
Overall layout
| Control | Default | Notes |
|---|---|---|
| Max width | — | Width of the whole widget (760px in the inline CSS) |
| Widget alignment | Center | Right / Center / Left |
| Gap between cards | 14px | Vertical spacing of items |
Card body
| Control | Default | Notes |
|---|---|---|
| Background | rgba(255,255,255,0.72) | Card background |
| Background (open) | — | Only for the open item |
| Border color (open) | — | Border of the open item |
| Glass blur amount | 12px | The backdrop-filter effect |
| Border radius | 12px | Card corner radius |
Title
| Control | Default |
|---|---|
| Title row background | — |
| Text color | #1F2937 |
| Title row background (open) | — |
| Text color (open) | — |
| Text color (hover) | — |
| Title row border radius | — |
| Padding | 20px 24px |
Answer card
| Control | Default |
|---|---|
| Background | — |
| Text color | #6B7280 |
| Background (open) | — |
| Text color (open) | — |
| Border radius | — |
| Padding | 0 24px 22px |
Icon
| Control | Default |
|---|---|
| Spacing from text | 16px |
| Box size | 30px |
| Icon size | 16px |
| Box radius | 8px |
| Custom icon rotation when open (deg) | 180deg |
| Background | #EBF3FC |
| Icon color | #2E86DE |
| Background (open) | #2E86DE |
| Icon color (open) | #ffffff |
Custom styling example
To change the appearance outside the controls, this snippet in your theme's custom CSS is enough:
.wgcr-faq-item {
border-radius: 16px;
box-shadow: 0 2px 10px rgb(15 23 42 / 6%);
}
.wgcr-faq-item.open .wgcr-faq-qtext {
color: #1d4ed8;
}
@media (prefers-reduced-motion: reduce) {
.wgcr-faq-a { transition: none; }
}
Complete control reference
Every content control of the widget, in panel order. Style controls are listed in “Style sections” above.
| Id | Panel label | Type | Default | Shown when |
|---|---|---|---|---|
items | Items | Repeater | Three sample questions | — |
question | Question title | Text | “Question title” | Inside each item |
answer | Answer | Text editor | “Answer text…” | Inside each item |
open_default | Open by default | Switcher | No | Inside each item |
mode | Open mode | Select | accordion | — |
icon_type | Icon | Select | plus | — |
custom_icon | Custom icon | Icon picker | fas fa-plus | icon_type = custom |
speed | Animation speed (ms) | Slider, 100 to 1000 | 300 | — |
q_tag | Question title tag | Select | h3 | — |
schema | FAQ schema (JSON-LD) | Switcher | Yes | — |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Items do not open | The widget script did not load | Check in developer tools whether wgcr-faq loaded; clear caches |
| A very long answer is clipped | The script did not run, so the CSS cap (max-height: 640px) applies | With the script running, each answer's height is set to its real content height; clear caches |
| No schema on the page | The “FAQ schema” control is off, or this is the second widget | Turn the control on or move the widget first |
| The custom icon does not rotate | The icon type is not “Custom” | Set “Icon” to “Custom (Elementor icon library)” |