posit-dev / posit-dev/py-shiny

Text box action items

Open
#602 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

It would be great if we could respond to typing actions within text boxes similar to how we respond to row selection within data tables. This would be great for things like todolists, or anywhere where the user was using text boxes to enter data. Currently people need to add an action button to handle this interaction, but it would be cleaner to respond to the carriage return.

from shiny import App, render, ui, reactive

app_ui = ui.page_fluid(
    ui.h2("Hello Shiny!"),
    ui.input_text("entry", "Enter text"),
    ui.output_text_verbatim("txt"),
)


def server(input, output, session):
    @output
    @render.text
    @reactive.event(input.entry_carriage())
    def txt():
        with reactive.isolate():
            txt = input.entry()

        return f"You entered {txt}"


app = App(app_ui, server)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ui.input_text component and the input.entry_carriage() event shown in the example, then inspect how row-selection actions are exposed. Done means a text-box carriage return can trigger a reactive response without requiring a separate action button, as demonstrated by the supplied app.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.