theme: Var[Theme] = field(
default=Theme.one_light,
doc="The theme to use, accessed via rx.code_block.themes (e.g. rx.code_block.themes.one_dark).",
)
language: Var[LiteralCodeLanguage] = field(
default=Var.create("python"), doc="The language to use."
)
code: Var[str] = field(doc="The code to display.")
show_line_numbers: Var[bool] = field(
doc="If this is enabled line numbers will be shown next to the code block."
)
starting_line_number: Var[int] = field(doc="The starting line number to use.")
wrap_long_lines: Var[bool] = field(doc="Whether to wrap long lines.")
custom_style: dict[str, str | Var | Color] = field(
doc="A custom style for the code block.",
default_factory=dict,
is_javascript_property=False,
)
code_tag_props: Var[dict[str, str | dict[str, str]]] = field(
doc="Props passed down to the code tag."
)
# Whether a copy button should appear.
can_copy: bool | None = field(
default=False,
is_javascript_property=False,
)
# A custom copy button to override the default one.
copy_button: bool | Component | None = field(
default=None,
is_javascript_property=False,
)
Describe the Enhancement you want
Would like playwright integration tests for the
rx.code_block-- end to end check of functionality.We've got quite a few props on the code_block, some of which significantly change its rendered structure and there is currently no validation that these props continue to work.
Avoid regressions in code_block functionality as the framework changes around it.