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

    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
    shouldTriggerSaveCallback{ componentType?: string; defaultValue: unknown; existingValue: unknown; formName?: string; name: string; shouldTriggerSaveCallback?: boolean; }Defaults 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

    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.