Skip to main content

Enabled settings sections

Any script can declare an enabled section. The switch controls the feature; its dropdown appears only while enabled. Opening the dropdown reveals its options. Disabling the feature hides them without erasing their values.

Declare the UI in bundle.json, not in Lua rendering code:

{
"configSchemaVersion": 1,
"configSchema": {
"type": "object",
"additionalProperties": false,
"required": ["collect_enabled", "collect_minimum"],
"properties": {
"collect_enabled": {
"type": "boolean",
"title": "Collection",
"default": false,
"disclosure": true
},
"collect_minimum": {
"type": "integer",
"title": "Minimum items",
"default": 3,
"minimum": 1,
"maximum": 20,
"step": 1,
"format": "slider",
"visibleWhen": {"field": "collect_enabled", "equals": true}
}
}
}
}

disclosure is valid only on a boolean with at least one child that is visible when it is true. Children can have further conditional children. Hidden controls cannot receive clicks or keyboard focus. Opening and closing animate using the same controls as other settings; reduced motion removes the transition.

With the section focused, Space toggles the feature. Enter opens or closes an enabled section, Right opens it, and Left closes it. The section starts collapsed when opening the script's settings.

Lua receives ordinary saved values, independent of whether the dropdown is open:

local settings = hexis.config.snapshot()

local minimum = settings.collect_enabled and settings.collect_minimum or nil

This metadata does not add collection behavior or permissions. Your script still implements the feature and declares its capabilities. Without disclosure, ordinary visibleWhen fields appear directly when their condition is met. See Script settings for validation and migrations.