from textual.app import App, ComposeResult
from textual.widgets import Input, Static


class InputApp(App):
    CSS = "Screen { layout: vertical; }"

    def compose(self) -> ComposeResult:
        yield Static("Enter your name:", id="label")
        yield Input(placeholder="Name...", id="name-input")
        yield Input(placeholder="Password...", id="password-input", password=True)
        yield Static("", id="output")

    def on_input_submitted(self, event: Input.Submitted) -> None:
        if event.input.id == "name-input":
            self.query_one("#output", Static).update(f"Hello, {event.value}!")
