Adds an FAQ accordion component. When language is enabled, it uses translations from content.faq (heading + faqs). When language is disabled, it uses modules.faq from your config (same shape). The addon does not merge any config — you define modules.faq yourself. Uses MOTA addon CLI (e.g. from dapp-starter).
- SvelteKit project with MOTA addon CLI.
$lib/helpers/i18nand$lib/helpers/siteConfig.- For translations when language is enabled:
src/i18n/<lang>/index.ts(e.g. typesafe-i18n) and the addon’s_langmerge.
From your project root:
npx addon <repo> faq installExample:
npx addon bchainhub/mota-addon-faq faq install- Component —
src/lib/components/faq/Faq.svelteandsrc/lib/components/faq/index.ts(exportsFaq). - Translations — Merged into
src/i18n/en/index.tsundercontent.faq(heading + faqs array). English sample only; add other locales as needed.
Config is not added by the addon. You must add modules.faq in your app config (e.g. in vite.config.ts or wherever getSiteConfig() reads from). It is used when language is disabled and as fallback when content.faq is missing.
After install, run your i18n step if needed (e.g. npx typesafe-i18n --no-watch).
Add a faq block under the modules object your app uses (e.g. in vite.config.ts):
// Example: in vite.config.ts (or wherever getSiteConfig() reads from)
modules: {
faq: {
heading: 'FAQ', // optional; default "FAQ" when language disabled
faqs: [
{ question: 'Question 1?', answer: 'Answer 1.' },
{ question: 'Question 2?', answer: 'Answer 2.' }
]
}
}- When language is enabled — The component uses
content.faqfrom i18n (heading + faqs). Add/edit translations per locale. - When language is disabled — The component uses
modules.faq.heading(optional) andmodules.faq.faqsfrom this config. Same shape as the translation structure.
FAQ is always shown (no enabled flag). Import and use <Faq /> in a route:
<script lang="ts">
import { Faq } from '$lib/components/faq';
</script>
<Faq />Or on a dedicated page, e.g. src/routes/[[lang]]/faq/+page.svelte:
<script lang="ts">
import { Faq } from '$lib/components/faq';
</script>
<Faq />Translations are merged at content.faq:
content.faq.heading— Section title (e.g. "FAQ").content.faq.faqs— Array of{ question, answer }. Add more locales and entries as needed.
From your project root:
npx addon <repo> faq uninstall- The
content.faqtranslation block fromsrc/i18n/en/index.ts. src/lib/components/faq/Faq.svelteandsrc/lib/components/faq/index.ts.
Your modules.faq config is not removed; remove it manually if you want.
Optional flags:
npx addon <repo> faq uninstall --dry-run
npx addon <repo> faq uninstall --no-translations
npx addon <repo> faq uninstall --no-scripts| Flag | Short | Description |
|---|---|---|
--cache |
-c |
Use cache dir for repo. |
--dry-run |
-d |
No writes; scripts and _lang skipped. |
--no-translations |
-nt |
Skip _lang processing. |
--no-scripts |
-ns |
Skip _scripts execution. |
Append #<ref> to the repo:
npx addon bchainhub/mota-addon-faq#v1.0.0 faq installLicensed under the MIT License.