Keyboard shortcut: Ctrl + K
Get started

JavaScript helpers

Functions for configuring localisation and icons, and displaying notifications. Import them by name from vectis-ui.

Public exports

ExportPurpose
setLocale(tag)Sets the global language and default regional formats. Components with a locale prop can override formats.
registerMessages(lang, messages)Registers or updates a language dictionary. Omitted keys retain previous translations, then fall back to English.
en · frEnglish and French dictionaries. English is the default; import and register fr to enable French.
setIconResolver(fn)Registers the icon resolver. Return undefined to use the imported SVG or ligature fallback.
ligatureIconResolver()Creates a resolver that renders icon names with a ligature font.
classIconResolver(options)Creates a resolver for CSS classes. By default, built-in names without an alias retain their fallback.
componentIconResolver(options)Creates a resolver that maps icon names to Vue components.
toast(options) · dismissToast(id)Adds a toast and returns its ID. dismissToast(id) removes it; omit the ID to remove all toasts. Render VToaster to display them.
snackbar(options) · dismissSnackbar(id)Shows a snackbar and returns its ID, replacing the previous snackbar. dismissSnackbar(id) removes the matching snackbar; omit the ID to remove the current one. Render VSnackbar to display it.
ts
// Configure localisation at application startup.
import { fr, registerMessages, setLocale } from 'vectis-ui'

registerMessages('fr', fr)
setLocale('fr-FR')

Locale and icon configuration are shared across the process. Configure them at application startup; for concurrent multilingual SSR, pass text and locale props explicitly. Call toast and snackbar in browser event handlers or onMounted hooks.

ts
import { toast } from 'vectis-ui'

// Call from a browser event handler. Render VToaster in the application.
toast({ message: 'Copied to the clipboard', duration: 1600 })

Types are exported alongside the functions, including MessagesInput, IconResolver, ToastOptions and SnackbarOptions. Component pages document their own types.

Internal helpers

Date, time, file and text utilities are internal implementation details. They are not public exports.

Composables

The library’s composables are internal. Use the component props, events and slots documented on each component page.