{"_path":"/guide/options","_draft":false,"_partial":false,"_locale":"en","_empty":false,"title":"Options","description":"Discover how to configure your theme with @nuxt-themes/config API.","excerpt":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"theme.options"}]},{"type":"text","value":" is a plain object definition that gets processed by "},{"type":"element","tag":"a","props":{"href":"https://github.com/unjs/untyped","rel":["nofollow"]},"children":[{"type":"text","value":"untyped"}]},{"type":"text","value":" to generate a type definition object."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This allows the options defined by the theme author in his "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"theme.options"}]},{"type":"text","value":" key to be type-safe."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The theme user that will configure his theme via the same key or a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"theme.config"}]},{"type":"text","value":" file will get auto-completion from the configuration you defined."}]},{"type":"element","tag":"h3","props":{"id":"defining-theme-options"},"children":[{"type":"text","value":"Defining theme options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"There is two ways to define theme options:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Via the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"theme.options"}]},{"type":"text","value":" key in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nuxt.config"}]},{"type":"text","value":" file."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Via the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"theme.config"}]},{"type":"text","value":" file at the root of your project."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Both of these options will be merged an available via the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$theme"}]},{"type":"text","value":" global property and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useTheme"}]},{"type":"text","value":" in your app."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These two ways will both work for theme authors and theme users as they will get processed in order of priority (user configuration > theme defaults)."}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"export default defineThemeConfig({\n theme: {\n options: {\n header: true,\n footer: {\n text: 'Made by NuxtLabs',\n credits: false\n }\n }\n }\n})\n","filename":"nuxt.config.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineThemeConfig({\n theme: {\n options: {\n header: true,\n footer: {\n text: 'Made by NuxtLabs',\n credits: false\n }\n }\n }\n})\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"import { defineTheme } from '@nuxt-themes/config'\n\nexport default defineTheme({\n header: true,\n footer: {\n text: 'Made by NuxtLabs',\n credits: false\n }\n})\n","filename":"theme.config.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { defineTheme } from '@nuxt-themes/config'\n\nexport default defineTheme({\n header: true,\n footer: {\n text: 'Made by NuxtLabs',\n credits: false\n }\n})\n"}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"consuming-theme-options"},"children":[{"type":"text","value":"Consuming theme options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Theme options gets merged by "},{"type":"element","tag":"a","props":{"href":"https://github.com/unjs/defu","rel":["nofollow"]},"children":[{"type":"text","value":"defu"}]},{"type":"text","value":" and a type gets generated from it by "},{"type":"element","tag":"a","props":{"href":"https://github.com/unjs/untyped","rel":["nofollow"]},"children":[{"type":"text","value":"untyped"}]},{"type":"text","value":"."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This merged object will get injected into your app and be available everywhere."}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Composable usage"}]},{"type":"element","tag":"code","props":{"code":"const theme = useTheme()\n\nconst hasHeader = computed(() => !!theme.value.header)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const theme = useTheme()\n\nconst hasHeader = computed(() => !!theme.value.header)\n"}]}]}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"