Core Composables
API reference for configuration, UI state, clipboard, analytics, and routing composables provided by @nuxtify/core.
Overview
- Provided by:
@nuxtify/core(re-typed by@nuxtify/pagesand@nuxtify/cmswhere extended) - Source directory:
src/runtime/composables/
All composables below are auto-imported across your Nuxt app with lower import priority (-30), so creating a composable with the same name in app/composables/ cleanly overrides the built-in implementation.
Configuration & Head
useNuxtifyConfig()
- Provided by:
@nuxtify/core(typed extensions provided by@nuxtify/pagesand@nuxtify/cms) - Available on: Client and Server (re-exported via
src/runtime/server/composables/client.ts) - Source:
src/runtime/composables/nuxtify.ts
Returns the resolved useAppConfig().nuxtify configuration object with full TypeScript types matching the highest Nuxtify module installed in your project.
const nuxtifyConfig = useNuxtifyConfig()
console.log(nuxtifyConfig.brand?.name)
useNuxtifySiteTitle(options?)
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/nuxtify.ts
Configures Unhead's titleTemplate as %s <separator> <siteName>, defaulting to brand.name from useNuxtifyConfig().
useNuxtifySiteTitle({
separator: '|', // default: '|'
siteName: '', // default: nuxtifyConfig.brand?.name
})
Global UI State
useDialog()
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/dialog.ts
Returns a Nuxt useState<Dialog>('dialog') ref bound to AppDialog.
export interface Dialog {
show: boolean
title: string
message: string
action: {
button: {
color?: string
text: string
prependIcon?: string
appendIcon?: string
}
function: (() => Promise<void>) | (() => void) | null
loading?: boolean
}
closeButtonText: string
}
const dialog = useDialog()
function confirmDelete() {
dialog.value = {
...dialogInitialState,
show: true,
title: 'Delete item?',
message: 'This action cannot be undone.',
action: {
button: { text: 'Delete', color: 'error' },
function: async () => {
dialog.value.action.loading = true
await deleteItem()
dialog.value.show = false
},
loading: false,
},
}
}
dialogInitialState is also exported from dialog.ts so you can reset all dialog fields cleanly.
useToast()
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/state.ts
Returns a Nuxt useState ref ({ show: boolean, message: string }) bound to AppToast.
const toast = useToast()
toast.value.message = 'Settings saved!'
toast.value.show = true
useDrawer()
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/state.ts
Returns useState<boolean | null>('drawer', () => null) controlling the mobile AppNavigationDrawer toggled from AppHeader.
useErrorMessage()
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/state.ts
Returns useState<string>('errorMessage', () => '') bound to AppError.
Routing, Clipboard & Analytics
useRouteParam(param)
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/route.ts
Wraps useRoute() and returns route.params[param] normalized to a string (taking the first element if it is an array, or '' if missing).
const slug = useRouteParam('slug') // string
useCopyText
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/util.ts
useCopyText(text, label?) copies text to the user's clipboard using navigator.clipboard.writeText and displays a confirmation (or unavailability error) through useToast().
| Parameter | Type | Default | Description |
|---|---|---|---|
text | string | Required | Text to write to the clipboard. |
label | string | 'Text' | Prefix shown in the toast message ("${label} copied!"). |
useAnalytics()
- Provided by:
@nuxtify/core - Source:
src/runtime/composables/analytics.ts
Lightweight analytics hook interface called by Nuxtify components (for example, EmailSubscribeForm calls userSignUp() after a successful form submission). By default, each method logs to the console only when verboseLogs: true. Override app/composables/useAnalytics.ts to forward events to your analytics provider (PostHog, Plausible, GA4, etc.).
Returned Methods
| Method | Signature | Description |
|---|---|---|
userSignUp | () => void | Fires when a user signs up or subscribes. |
userSignIn | () => void | Fires when a user signs in. |
userSignOut | () => void | Fires when a user signs out. |
userUpgrade | (planId: string) => void | Fires when a user upgrades to a paid plan. |