useConfig
Reactive config store with get, set, and merge methods.
The config store provides reactive read and write access to the tour configuration at runtime. Access it through instance.config.
Methods
| Method | Description |
|---|---|
current | Current resolved config snapshot (reactive) |
getConfig() | Returns the current config object |
setConfig(value) | Replaces the entire config with a new value |
mergeConfig(partial) | Deeply merges a partial config into the current one |
Usage
// Read current config
const config = instance.config.current;
// Get a snapshot
const snapshot = instance.config.getConfig();
// Replace entirely
instance.config.setConfig({
steps: [
{
target: '#new-element',
title: 'New tour',
description: 'Starting fresh.',
placement: 'bottom-center',
},
],
});
// Deep merge — only specified fields are updated
instance.config.mergeConfig({
size: ComponentSize.LG,
tourButtons: { skip: false },
});
Both setConfig and mergeConfig trigger a reactive update — the widget re-renders immediately without remounting.