Skip to main content

useLumioConfig

Read and write the extension's user-configurable settings as defined in config_schema in lumio.config.json. Config values are persisted per installation and displayed in a dedicated settings UI separate from the main editor panel.

Signature

const [config, setConfig] = useLumioConfig<T>();

Parameters

This hook takes no parameters.

Return value

Returns a tuple of two values:

IndexTypeDescription
0TCurrent config object (typed by your config_schema)
1(config: T) => voidSetter function to update config values

Example

Define the schema in lumio.config.json:

{
"config_schema": {
"primaryColor": {
"type": "string",
"label": "Primary color",
"default": "#6366f1"
},
"showAvatar": {
"type": "boolean",
"label": "Show avatar",
"default": true
},
"fontSize": {
"type": "number",
"label": "Font size (px)",
"default": 16
}
}
}

Then use it in any surface:

import { useLumioConfig, Text, Box } from "@zaflun/lumio-sdk";

interface MyConfig {
primaryColor: string;
showAvatar: boolean;
fontSize: number;
}

function AlertOverlay() {
const [config] = useLumioConfig<MyConfig>();

return (
<Box
style={{
background: config.primaryColor,
fontSize: config.fontSize,
}}
>
<Text content="New follower!" variant="heading" />
</Box>
);
}

Difference from useExtensionStorage

useLumioConfiguseExtensionStorage
SchemaDefined in config_schema (typed)Untyped key-value
UIAuto-generated settings panelCustom editor panel in src/editor.tsx
PurposeUser-facing settings (theme, preferences)Runtime state (scores, current topic)
ScopePer installationPer installation

Notes

  • The config values are initialized with defaults from config_schema on first install
  • Changes to config trigger a re-render on all surfaces that use useLumioConfig()
  • Config is not intended for high-frequency updates (use useExtensionStorage() for that)
  • Type parameter T is optional but strongly recommended for type safety