def update(
    elem_id: str | None = None,
    elem_classes: list[str] | str | None = None,
    visible: bool | None = None,
    **kwargs: Any,
) -> dict[str, Any]:
    """
    Updates a component's properties. When a function passed into a Gradio Interface or a Blocks
    events returns a value, it typically updates the value of the output component. But it is also possible
    to update the *properties* of an output component (such as the number of lines of a `Textbox` or
    the visibility of an `Row`) by returning a component and passing in the parameters to update in
    the constructor of the component. Alternatively, you can return `gr.update(...)` with any arbitrary
    parameters to update. (This is useful as a shorthand or if the same function can be called with different
    components to update.) This method does not work with the `gr.State` component.

    Parameters:
        elem_id: Use this to update the id of the component in the HTML DOM
        elem_classes: Use this to update the classes of the component in the HTML DOM
        visible: Use this to update the visibility of the component
        kwargs: Any other keyword arguments to update the component's properties.
    Example:
        import gradio as gr
        with gr.Blocks() as demo:
            radio = gr.Radio([1, 2, 4], label="Set the value of the number")
            number = gr.Number(value=2, interactive=True)
            radio.change(fn=lambda value: gr.update(value=value), inputs=radio, outputs=number)
        demo.launch()
    """
    kwargs["__type__"] = "update"
    if elem_id is not None:
        kwargs["elem_id"] = elem_id
    if elem_classes is not None:
        kwargs["elem_classes"] = elem_classes
    if visible is not None:
        kwargs["visible"] = visible
    return kwargs

    Updates a component's properties. When a function passed into a Gradio Interface or a Blocks
    events returns a value, it typically updates the value of the output component. But it is also possible
    to update the *properties* of an output component (such as the number of lines of a `Textbox` or
    the visibility of an `Row`) by returning a component and passing in the parameters to update in
    the constructor of the component. Alternatively, you can return `gr.update(...)` with any arbitrary
    parameters to update. (This is useful as a shorthand or if the same function can be called with different
    components to update.) This method does not work with the `gr.State` component.

    Parameters:
        elem_id: Use this to update the id of the component in the HTML DOM
        elem_classes: Use this to update the classes of the component in the HTML DOM
        visible: Use this to update the visibility of the component
        kwargs: Any other keyword arguments to update the component's properties.
    Example:
        import gradio as gr
        with gr.Blocks() as demo:
            radio = gr.Radio([1, 2, 4], label="Set the value of the number")
            number = gr.Number(value=2, interactive=True)
            radio.change(fn=lambda value: gr.update(value=value), inputs=radio, outputs=number)
        demo.launch()
    
gradio/helpers.py