# How to Build a Reusable Collapsible FAQ Panel | Creght Visual Documentation

> Demo Overview This tutorial walks you through building a clickable, expandable and collapsible FAQ panel component from scratch.…

[![Creght](https://ugc.talizen.com/_assets/site/2061660904709165056/1780797461299__creght_logo.png)Help Center](/help)

[Changelog](/blogs)

[AI](/docs/ai/quick-create-first-website) [Visual](/docs/get-start)

Basic

- [Get to Know Creght in 2 Minutes](/docs/get-start)
- [How to Register for Creght](/docs/signup)
- [Creating a Project in Creght](/docs/create-site)
- [Templates](/docs/tpls)

Design

- [Using the Editor](/docs/editor)
- [Basic Operations](/docs/operating)
- [Layouts in Creght](/docs/layout)
- [Position in Creght](/docs/position)
- [Size in Creght](/docs/size)
- [Breakpoints in Creght](/docs/breakpoint)
- [Overlays](/docs/popover)
- [Components in Creght](/docs/components)
- [Adding Third-Party Fonts](/docs/tp-font)
- [Duplicate and Deep Copy](/docs/deep-copy)

CMS

- [CMS (Content Management System)](/docs/cms)
- [Importing WeChat Official Account Articles into CMS](/docs/wxmp)

Site Setting

- [Page Settings](/docs/page-setting)
- [How to Upgrade a Plan](/docs/manage-plan)
- [SEO Settings](/docs/seo-setting)
- [Small Files (Site Verification)](/docs/verification-file)
- [Adding a Custom Domain in Creght](/docs/custom-domain)
- [How to Complete ICP Filing](/docs/beian)
- [Server Nodes](/docs/website-node)
- [How to Switch Sites](/docs/pxrp79jqtnyq)
- [Localization](/docs/localization)

AI

- [About Creght AI](/docs/creght-ai)
- [AI Text Processing](/docs/ai-text)
- [AI - Page Generation](/docs/ai-generate)

Tool

- [Convert Figma Designs into Live Websites](/docs/figma-to-creght)
- [3 Guidelines for Responsive Figma Layouts](/docs/figma-autolayout)
- [Covert Figma to live website](/docs/response-site)
- [Figma to Responsive Website: Interactions](/docs/figma03)
- [Compressing Video with FFmpeg](/docs/ffmpeg)
- [How to Add Clarity to Your Website](/docs/clarity)
- [Creating a Button Hover Effect](/docs/button)
- [How to Build a Reusable Collapsible FAQ Panel](/docs/collapse)
- [Responsive Navigation Tutorial](/docs/nav)

Tool/

# How to Build a Reusable Collapsible FAQ Panel

## Demo Overview

This tutorial walks you through building a **clickable, expandable and collapsible FAQ panel component** from scratch. You will also turn it into a **reusable component structure** suitable for FAQs, help centers, and similar use cases.

## Step 1: Create the Component

1. Select the layer that contains the **item**.
2. Right-click, create a component, and name it `FAQItem`.

As shown below:

![image.png](https://fsu.creght.com/user/3/mmLaHiQEvfx__image.png)

## Step 2: Set Up Component Variants (Collapsed / Expanded)

### 1\. Adjust the Base Component Structure

- Select the outermost component.
- Set its height to **Auto**.

![image.png](https://fsu.creght.com/user/3/mmLaHkkUekO__image.png)

### 2\. Configure the Default Variant (Collapsed State)

In the Default variant:

- Set the visibility of the **answer text** and **divider** to **Off**.
- Remove the background style from the root component.

![image.png](https://fsu.creght.com/user/3/mmLaHlyUjcP__image.png)

### 3\. Add an Expanded Variant

1. Add a new component variant.

![image.png](https://fsu.creght.com/user/3/mmLaHmDIfhB__image.png)

2. In Variant 1:
   - Set the visibility of the **answer text** and **divider** to **On**.
   - Add a **light purple background** to the component.

     ![image.png](https://fsu.creght.com/user/3/mmLaHnPkSRx__image.png)
3. Select the **arrow icon** and rotate it **180°** to indicate the expanded state.

![image.png](https://fsu.creght.com/user/3/mmLaHpdurmb__image.png)


## Step 3: Add Interaction Logic

### 1\. Collapsed → Expanded

- In the **Default variant**, select the title group.
- Click the **“+” under Interactions** in the right panel and choose **Variant**.

![image.png](https://fsu.creght.com/user/3/mmLaHqnJkSz__image.png)

- Choose **Click** as the trigger.
- Set the target variant to **Variant 1**.

![image.png](https://fsu.creght.com/user/3/mmLaHsMAzwq__image.png)


### 2\. Expanded → Collapsed

- In **Variant 1**, select the title group.
- Adjust the click interaction.
- Set the target variant to **Default**.

![image.png](https://fsu.creght.com/user/3/mmLaHtSmiHp__image.png)


## Preview the Result

Preview the page. Clicking the title should now expand and collapse the content.

![](https://fsu.creght.com/project/mtdDqMgsnYi/mmLaRafmWWH__preview_02.gif)

## Make the Component Highly Reusable

### 1\. Turn the Copy into Variables

### Title Text

1. Select the title text component.
2. In the text properties, click **“+” → Create Variable**.

![image.png](https://fsu.creght.com/user/3/mmLaHuZnoSm__image.png)


After creation, the title is bound to a text variable:

![](https://fsu.creght.com/project/mtdDqMgsnYi/mmLaLiGyqDb__image.png)

Click the blue variable name to rename it to something more meaningful, such as Title:

![](https://fsu.creght.com/project/mtdDqMgsnYi/mmLaLNdLpXQ__image.png)

### Answer Text

- Select the **answer text component** in the Default state.
- Create a text variable in the same way, such as Answer.

![image.png](https://fsu.creght.com/user/3/mmLaHwCBZTS__image.png)


### 2\. Configure Component Content on the Page

1. Return to the page.
2. Select the **FAQItem** component.
3. In the component properties on the right, you will see two configurable fields: **Title** and **Answer**.

![image.png](https://fsu.creght.com/user/3/mmLaHxLozKU__image.png)


After changing the title, the page content updates automatically:

![](https://fsu.creght.com/project/mtdDqMgsnYi/mmLaNadhYOU__image.png)

### 3\. Reuse It for Other Questions

1. Select another question group.
2. Right-click → **Replace with Component** → choose **FAQItem**.

![image.png](https://fsu.creght.com/user/3/mmLaHzDSmuR__image.png)


Then simply update the corresponding title and answer:

![](https://fsu.creght.com/project/mtdDqMgsnYi/mmLaNWmamjl__image.png)

Repeat the same process for the remaining questions.

## Summary

By combining components, variants, interactions, and text variables:

- You can quickly build a **click-to-expand collapsible panel**.
- All styles are maintained centrally while content remains configurable.
- Future component changes only need to be made once, and every instance on the page updates automatically.

You now have a **highly reusable and easy-to-maintain collapsible FAQ component** 🚀

On this page

- [Demo Overview](#heading-52k91stfx)
- [Step 1: Create the Component](#heading-cy7aslsrf)
- [Step 2: Set Up Component Variants (Collapsed / Expanded)](#heading-9665u6rl7)
- [1\. Adjust the Base Component Structure](#heading-qehj0n1y6)
- [2\. Configure the Default Variant (Collapsed State)](#heading-kgozp4eja)
- [3\. Add an Expanded Variant](#heading-inp0h1d3t)
- [Step 3: Add Interaction Logic](#heading-nzb13b4k9)
- [1\. Collapsed → Expanded](#heading-gn4foim63)
- [2\. Expanded → Collapsed](#heading-np5g1c6yi)
- [Preview the Result](#heading-tl23fytfm)
- [Make the Component Highly Reusable](#heading-gpdkmctrc)
- [1\. Turn the Copy into Variables](#heading-mibu6a9dl)
- [Title Text](#heading-b0mi6hwc9)
- [Answer Text](#heading-30xp96q37)
- [2\. Configure Component Content on the Page](#heading-x51ufaskt)
- [3\. Reuse It for Other Questions](#heading-xb9u100vq)
- [Summary](#heading-jhni2s4um)

![Creght](https://ugc.talizen.com/_assets/site/2061660904709165056/1780797461299__creght_logo.png)

This website is built with [Creght](/)

[Discord](https://discord.gg/Qvq2nmZNnb)

## Links

- [Pricing](/price)
- [Help Center](/help)
- [Contact Us](/contact)
- [Blog](/blogs)
- [Refund Policy](/tuikuan)

## Resources

- [All Resources](/resources)
- [Templates](/templates)
- [Components](https://creghtlib.site.creght.com)
- [Animations](/effects)
- [Figma to Creght](/figma2creght)
- [API for AI](/api)

## Terms

- [Terms of Service](/legal/terms)
- [Privacy Policy](/legal/privacy)
- [Acceptable Use Policy](/legal/acceptable-use)

## Social Media

- [Twitter](https://twitter.com)
- [Facebook](https://www.facebook.com)
- [LinkedIn](https://www.linkedin.com)

[蜀ICP备2023038192号-2](https://beian.miit.gov.cn)
