how to make OptionList scrollable if i have so many items on it? #3367
              
                
                  
                  
                    Answered
                  
                  by
                    davep
                  
              
          
                  
                    
                      MohamedElgamal
                    
                  
                
                  asked this question in
                Q&A
              
            -
| 
         Hello everyone,  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            davep
          
      
      
        Sep 21, 2023 
      
    
    Replies: 1 comment
-
| 
         This is another good example of a question that deserves a minimal runnable example of the problem. For example, sans some other styling, the  from textual.app import App, ComposeResult
from textual.widgets import OptionList
class OLScrollApp(App[None]):
    def compose(self) -> ComposeResult:
        yield OptionList(*[f"This is option number {n}" for n in range(5000)])
if __name__ == "__main__":
    OLScrollApp().run()but with styling to tell  from textual.app import App, ComposeResult
from textual.widgets import OptionList
class OLScrollApp(App[None]):
    CSS = """
    OptionList {
        height: 1fr;
    }
    """
    def compose(self) -> ComposeResult:
        yield OptionList(*[f"This is option number {n}" for n in range(5000)])
if __name__ == "__main__":
    OLScrollApp().run() | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        MohamedElgamal
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
This is another good example of a question that deserves a minimal runnable example of the problem. For example, sans some other styling, the
OptionListlikely isheight: auto. So this example would show the problem:but with styling to tell
OptionListhow tall it should be, scrolling will work as expected: