Docs for Release: 2.4.1
    Preparing search index...

    Interface ConfigDefinition

    Every Config value can be heavily customized in terms of validation behavior and browser rendering.

    Everything is optional, except for the type, which is used to validate inputs from all sources.

    These config options expose in-depth customization for each Config entry. If such a thing is desired, entirely new HTML elements can be modeled using this configuration.

    interface ConfigDefinition {
        argName?: string;
        argShort?: string;
        css?: string | string[];
        customClasses?: string[];
        default?: any;
        description?: string;
        displayName?: string;
        elementDisabled?: boolean;
        envName?: string;
        hideFromUI?: boolean;
        onInteract?: (path: string[], value: any) => any;
        skipLabel?: boolean;
        toHtml?: (conf: ConfigDefinition, currentValue: any) => string;
        type: ZodType;
        useZodTypeName?: "string" | "number" | "boolean" | "enum";
    }
    Index

    Properties

    argName?: string

    If defined, uses this command-line argument name instead of the default --category-config.

    argShort?: string

    If defined, uses this single-character command-line argument name instead of none.

    css?: string | string[]

    Inline CSS styles to apply to the auto-generated HTML element for this config element.

    customClasses?: string[]

    If defined, appends these classes to the auto-generated HTML element for this config element.

    default?: any

    The default value for this config element, if not provided from other sources.

    description?: string

    A short description of this config element, shown as a tooltip in hte UI.

    displayName?: string

    If defined, uses this display name instead of the key.

    elementDisabled?: boolean

    If true, will disable this config element in the UI. This value can be toggled with setEnabled.

    envName?: string

    If defined, uses this environment variable name instead of the default PREFIX_CATEGORY_CONFIG.

    hideFromUI?: boolean

    If true, will not show this config element in the UI, but will still load from env or other sources and be available in values.

    onInteract?: (path: string[], value: any) => any

    If defined, this function will be called when the user interacts with the config element in the UI.

    skipLabel?: boolean

    If true, will not generate a label for this config element. Useful when implementing custom toHtml.

    toHtml?: (conf: ConfigDefinition, currentValue: any) => string

    If defined, applies custom HTML rendering for this config element. If undefined, tries to auto-generate based on zod type.

    The HTML should utilize several special data tags that will be replaced with the values the panel expects. They are:

    • data-all - shorthand to automatically inject the other general data-tags.
    • data-id - The custom ID of the element, based off its category and name. 'id="gen_id"'
    • data-classes - Any custom class names applied in the Config. 'class="class1 class2"'
    • data-css - Custom CSS style rules applied directly to the element. 'style="border: 1px;"'
    • data-checked - Sets (or omits) the "checked" flag for radio buttons and checkboxes. 'checked'
    • VAL - The current value of the config element, as a double-quoted string. 'value=VAL' -> 'value="test-value"'
    type: ZodType

    The Zod type definition for this config element.

    useZodTypeName?: "string" | "number" | "boolean" | "enum"

    If defined, uses this Zod type name instead of trying to unwrap the type.

    This can be more convenient than redefining the HTML with toHtml, if the input type is simple. For instance, when using zod pipes that should accept simple string inputs.