codeblock.md 462 B


components:

- rx.code_block

import reflex as rx

CodeBlock

The CodeBlock component can be used to display code easily within a website. Put in a multiline string with the correct spacing and specify and language to show the desired code.

rx.code_block(
    """def fib(n):
    if n <= 1:
        return n
    else:
        return(fib(n-1) + fib(n-2))""",
    language="python",
    show_line_numbers=True,
)