The Motion Core CLI is the primary way to integrate components into your project. It automates the setup, dependency installation, and component scaffolding.
Installation
You can run the CLI directly using
npxbunxpnpm dlxnpx @motion-core/cli initnpx @motion-core/cli initCommands
init
initInitialize your project for Motion Core. This command will:
- Detect your framework (SvelteKit or Vite + Svelte).
- Detect your package manager.
- Create a file.
motion-core.json - Scaffold required directories and base utility files ().
cn.ts - Install base dependencies (,
clsx).tailwind-merge
motion-core initmotion-core initadd
addAdd a component from the registry to your project.
motion-core add [component-slug]motion-core add [component-slug]Options:
- : See what would be installed without making any changes.
--dry-run - : Skip confirmation prompts.
-y, --yes
list
listList all available components in the registry.
motion-core listmotion-core listcache
cacheManage the local cache for registry data and assets.
motion-core cache --clear --forcemotion-core cache --clear --forceConfiguration
The
motion-core.json{
"$schema": "https://motion-core.dev/registry/schema/config-schema.json",
"tailwind": {
"css": "src/routes/layout.css"
},
"aliases": {
"components": {
"filesystem": "src/lib/motion-core",
"import": "$lib/motion-core"
},
"helpers": {
"filesystem": "src/lib/motion-core/helpers",
"import": "$lib/motion-core/helpers"
},
"utils": {
"filesystem": "src/lib/motion-core/utils",
"import": "$lib/motion-core/utils"
}
},
"aliasPrefixes": {
"components": "$lib/motion-core"
},
"exports": {
"components": {
"barrel": "src/lib/motion-core/index.ts",
"strategy": "named"
}
}
}{
"$schema": "https://motion-core.dev/registry/schema/config-schema.json",
"tailwind": {
"css": "src/routes/layout.css"
},
"aliases": {
"components": {
"filesystem": "src/lib/motion-core",
"import": "$lib/motion-core"
},
"helpers": {
"filesystem": "src/lib/motion-core/helpers",
"import": "$lib/motion-core/helpers"
},
"utils": {
"filesystem": "src/lib/motion-core/utils",
"import": "$lib/motion-core/utils"
}
},
"aliasPrefixes": {
"components": "$lib/motion-core"
},
"exports": {
"components": {
"barrel": "src/lib/motion-core/index.ts",
"strategy": "named"
}
}
}