Skip to content

Util

ComponentState = object module-attribute

IDs

Bases: SimpleNamespace

conversation_scroll_area = 'conversation-scroll-area' class-attribute instance-attribute

main_user_input = 'main_user_input' class-attribute instance-attribute

MyComponentState

Bases: ComponentState

get_state(state_cls) async

error_notification(error_message)

generate_error_notification(exception)

notification(message)

render_copy_icon(copy_content, color_scheme=None, margin_top=None)

render_markdown(text, with_copy=True, copy_color_scheme=None)

Wrapper for rx.markdown with component_map overrides.

render_object_in_markdown(json_obj, indent=2)

Render an object/dict in a Markdown code block.

round_to_dp(value, dp)

Rounds in a way that reflex supports (note: Always rounds down).

scroll_to_element_end_script_event(element_id)

set_component_state_default(class_, attr_name, value)

Sets a new default value for the given attribute of the state class.

Temporary solution for changing default behaviour of ComponentState from: https://github.com/reflex-dev/reflex/issues/3771

Note: This is for use only when interacting with the cls object rather than the self used in event handlers.

to_json_markdown_str(data, indent=2)

to_json_str_var(data, indent=2)

Convert a var into a JSON formatted string var.

warning_notification(warning_message)