|
| 1 | +# FaqAccordion |
| 2 | +A vertically stacked accordion component designed for FAQ sections with 5-6 collapsible items. |
| 3 | + |
| 4 | +## Getting Started |
| 5 | + |
| 6 | +Install dependencies: |
| 7 | +```bash |
| 8 | +npm install |
| 9 | +``` |
| 10 | + |
| 11 | +Share the component to your Webflow workspace: |
| 12 | +```bash |
| 13 | +npx webflow library share |
| 14 | +``` |
| 15 | + |
| 16 | +For local development: |
| 17 | +```bash |
| 18 | +npm run dev |
| 19 | +``` |
| 20 | + |
| 21 | +## Designer Properties |
| 22 | + |
| 23 | +| Property | Type | Default | Description | |
| 24 | +|----------|------|---------|-------------| |
| 25 | +| ID | Id | — | HTML ID attribute for targeting and accessibility | |
| 26 | +| Heading | TextNode | Frequently Asked Questions | Main heading displayed above the accordion | |
| 27 | +| Subheading | Text | Find answers to common questions about our service | Optional subheading below the main heading | |
| 28 | +| Icon Position | Variant | right | Position of the expand/collapse icon (left or right) | |
| 29 | +| Default Open | Number | 1 | Index of the item to open by default (1-6, or 0 for none) | |
| 30 | +| Item 1 Question | Text | What is your return policy? | First item question text | |
| 31 | +| Item 1 Answer | RichText | We offer a 30-day money-back guarantee... | First item answer content with formatting support | |
| 32 | +| Item 1 Visible | Visibility | — | Show or hide the first accordion item | |
| 33 | +| Item 2 Question | Text | How long does shipping take? | Second item question text | |
| 34 | +| Item 2 Answer | RichText | Standard shipping typically takes 5-7 business days... | Second item answer content with formatting support | |
| 35 | +| Item 2 Visible | Visibility | — | Show or hide the second accordion item | |
| 36 | +| Item 3 Question | Text | Do you offer customer support? | Third item question text | |
| 37 | +| Item 3 Answer | RichText | Yes! Our customer support team is available 24/7... | Third item answer content with formatting support | |
| 38 | +| Item 3 Visible | Visibility | — | Show or hide the third accordion item | |
| 39 | +| Item 4 Question | Text | Can I change my subscription plan? | Fourth item question text | |
| 40 | +| Item 4 Answer | RichText | Absolutely! You can upgrade or downgrade... | Fourth item answer content with formatting support | |
| 41 | +| Item 4 Visible | Visibility | — | Show or hide the fourth accordion item | |
| 42 | +| Item 5 Question | Text | Is my data secure? | Fifth item question text | |
| 43 | +| Item 5 Answer | RichText | Security is our top priority... | Fifth item answer content with formatting support | |
| 44 | +| Item 5 Visible | Visibility | — | Show or hide the fifth accordion item | |
| 45 | +| Item 6 Question | Text | How do I cancel my account? | Sixth item question text | |
| 46 | +| Item 6 Answer | RichText | You can cancel your account at any time... | Sixth item answer content with formatting support | |
| 47 | +| Item 6 Visible | Visibility | — | Show or hide the sixth accordion item | |
| 48 | + |
| 49 | +## Styling |
| 50 | + |
| 51 | +This component automatically adapts to your Webflow site's design system through site variables and inherited properties. |
| 52 | + |
| 53 | +### Site Variables |
| 54 | + |
| 55 | +To match your site's design system, define these CSS variables in your Webflow project settings. The component will use the fallback values shown below until you configure them. |
| 56 | + |
| 57 | +| Site Variable | What It Controls | Fallback | |
| 58 | +|---------------|------------------|----------| |
| 59 | +| --background-primary | Main background color | transparent | |
| 60 | +| --background-secondary | Hover and active item background | #f5f5f5 | |
| 61 | +| --text-primary | Main text color for questions and headings | #1a1a1a | |
| 62 | +| --text-secondary | Subheading and answer text color | #737373 | |
| 63 | +| --border-color | Item borders and dividers | #e5e5e5 | |
| 64 | +| --accent-color | Active item highlight and links | #1a1a1a | |
| 65 | +| --border-radius | Corner rounding (not currently applied) | — | |
| 66 | + |
| 67 | +### Inherited Properties |
| 68 | + |
| 69 | +The component inherits these CSS properties from its parent element: |
| 70 | +- `font-family` — Typography style |
| 71 | +- `color` — Text color |
| 72 | +- `line-height` — Text spacing |
| 73 | + |
| 74 | +## Extending in Code |
| 75 | + |
| 76 | +### Custom Animation Timing |
| 77 | + |
| 78 | +Adjust the expand/collapse animation speed by modifying the transition duration: |
| 79 | + |
| 80 | +```css |
| 81 | +.wf-faqaccordion-content-wrapper { |
| 82 | + transition: max-height 0.5s ease; /* Slower animation */ |
| 83 | +} |
| 84 | + |
| 85 | +.wf-faqaccordion-icon { |
| 86 | + transition: transform 0.5s ease; /* Match icon rotation */ |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +### Add Custom Spacing Between Items |
| 91 | + |
| 92 | +Create visual separation between accordion items: |
| 93 | + |
| 94 | +```css |
| 95 | +.wf-faqaccordion-item { |
| 96 | + margin-bottom: 8px; |
| 97 | + border: 1px solid var(--border-color, #e5e5e5); |
| 98 | + border-radius: 8px; |
| 99 | + overflow: hidden; |
| 100 | +} |
| 101 | + |
| 102 | +.wf-faqaccordion-item:first-child { |
| 103 | + border-top: 1px solid var(--border-color, #e5e5e5); |
| 104 | +} |
| 105 | +``` |
| 106 | + |
| 107 | +## Dependencies |
| 108 | + |
| 109 | +No external dependencies. |
0 commit comments