For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/genui/openui/functions/useSetDefaultValue.md.
Lynx
  • English
  • genui / openui / useSetDefaultValue

    useSetDefaultValue()

    function useSetDefaultValue(shouldTriggerSaveCallback: object): void

    Persists a component's default/initial value into form state once streaming finishes — but only if the user hasn't already set a value.

    Call this inside any form component that has a defaultValue or defaultChecked prop. It is a no-op during streaming so that LLM prop changes don't fight with partial state.

    Parameters

    ParameterTypeDescription
    shouldTriggerSaveCallbackobjectDefaults to false (only local state, no message persistence).
    shouldTriggerSaveCallback.componentType?string-
    shouldTriggerSaveCallback.defaultValueunknown-
    shouldTriggerSaveCallback.existingValueunknown-
    shouldTriggerSaveCallback.formName?string-
    shouldTriggerSaveCallback.namestring-
    shouldTriggerSaveCallback.shouldTriggerSaveCallback?boolean-

    Returns

    void

    Defined in

    @lynx-js/genui/openui/src/core/context.tsx:182

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.