-
| 
         How to make Textarea appear when select Steps to reproduce option instead of by default?  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            davep
          
      
      
        Sep 25, 2023 
      
    
    Replies: 1 comment 12 replies
-
| 
         A combination of handling the  from textual import on
from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Select, Static, Input
class ShowHideExampleApp(App[None]):
    CSS = """
    Vertical > Static {
        height: 1fr;
        background: red;
    }
    .hidden {
        display: none;
    }
    """
    def compose(self) -> ComposeResult:
        with Vertical():
            yield Select(
                (("Show", "show"), ("Hide", "hide")),
                value="show", allow_blank=False
            )
            yield Static("Show/hide me")
            yield Input(placeholder="This comes after")
    @on(Select.Changed)
    def show_hide(self, event: Select.Changed) -> None:
        self.query_one("Vertical > Static").set_class(
            event.value == "hide", "hidden"
        )
if __name__ == "__main__":
    ShowHideExampleApp().run() | 
  
Beta Was this translation helpful? Give feedback.
                  
                    12 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Sure, there's a few different ways you could do it; looks like you're getting the idea now. For example: