404 Shiny module with reactive output

Instructions

Modify the module to include a @render.text element.

#| standalone: true
#| components: [viewer]
#| layout: horizontal
#| viewerHeight: 1500
from shiny.express import ui, input, render, module
from shiny import reactive

@module
def card_mod(input, output, session):
    with ui.card():
        ui.card_header("What is your name?")
        ui.input_text("text", "Your name?")
        @render.text
        def _text_out():
            if input.text() == "":
                return ""
            return f"Hello, {input.text()}!"


card_mod("card1")
#| standalone: true
#| components: [editor, viewer]
#| layout: horizontal
#| viewerHeight: 1500
from shiny.express import ui, input, render, module
from shiny import reactive

@module
def card_mod(input, output, session):
    with ui.card():
        ui.card_header("What is your name?")
        ui.input_text("text", "Your name?")
        # Your task:
        # Insert a render.text element here
        # The element should return "Hello, {name}!" if the input is not empty
        # But only if the input is not empty


card_mod("card1")
#| standalone: true
#| components: [editor, viewer]
#| layout: horizontal
#| viewerHeight: 1500
from shiny.express import ui, input, render, module
from shiny import reactive

@module
def card_mod(input, output, session):
    with ui.card():
        ui.card_header("What is your name?")
        ui.input_text("text", "Your name?")
        @render.text
        def _text_out():
            if input.text() == "":
                return ""
            return f"Hello, {input.text()}!"


card_mod("card1")