# How can i use tabs as an input?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-tabs-as-an-input%2F29380%3E%5C
**Category:** 🔒 Gradio\
**Created:** [January 11, 2023, 4:54pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-tabs-as-an-input%2F29380 "2023-01-11T16:54:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frenchranch](https://avatars.discourse-cdn.com/v4/letter/f/c57346/32.png) [@frenchranch](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffrenchranch)%5C
**Post date:** [January 11, 2023, 4:54pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-tabs-as-an-input%2F29380%2F1 "2023-01-11T16:54:41Z")

</div>

I’m creating some tabs and when i click a button i want to use the name of the tabs as an input for a function. How does it work? Thank you very much!

My way of creating tabs would be for example this, with blocks:

```auto
with gr.Tabs() as tabs:
                with gr.TabItem("test1"):
                    bt_test1 = gr.Button('test1')
                with gr.TabItem("test2"):   
                    bt_test2 = gr.Button('test2')

```

---

<div class="post-metadata">

**Author:** ![abidlabs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abidlabs/32/21878_2.png) [@abidlabs](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fabidlabs)%5C
**Post date:** [January 21, 2023, 2:50am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-tabs-as-an-input%2F29380%2F2 "2023-01-21T02:50:39Z")

</div>

You can use the `select()` event listener that `TabItem` (which also has the alias `Tab`) supports:

```python
import gradio as gr

with gr.Blocks() as demo:
    with gr.Tabs():
        with gr.Tab("hi") as hi:
            pass
        with gr.Tab("hello") as hello:
            pass
        
    output = gr.Textbox()
    hi.select(lambda :"hi", None, output)
    hello.select(lambda :"hello", None, output) 
    
demo.launch()

```
