--- tags: [gradio-custom-component, SimpleTextbox] title: gradio_iframecomponent short_description: iframe colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py --- # `gradio_iframecomponent` Static Badge iframe ## Installation ```bash pip install gradio_iframecomponent ``` ## Usage ```python import gradio as gr from gradio_iframecomponent import IFrame def create_demo(): with gr.Blocks() as demo: gr.Markdown("# IFrame Component Demo") iframe = IFrame( label="Web Page Viewer", value="https://www.gradio.app", interactive=True, height=500 ) url_input = gr.Textbox( label="Enter URL", placeholder="https://example.com" ) load_btn = gr.Button("Load URL") load_btn.click( fn=lambda url: url, inputs=url_input, outputs=iframe ) return demo if __name__ == "__main__": demo = create_demo() demo.launch() ``` ## `IFrame` ### Initialization
name type default description
value ```python str ``` "" None
src ```python str | None ``` None None
width ```python str | int ``` "100%" None
height ```python str | int ``` 400 None
sandbox ```python str | None ``` None None
interactive ```python bool ``` True None
visible ```python bool ``` True None
elem_id ```python str | None ``` None None
elem_classes ```python list[str] | str | None ``` None None
render ```python bool ``` True None
label ```python str | None ``` None None
show_label ```python bool ``` True None
### Events | name | description | |:-----|:------------| | `change` | Triggered when the value of the IFrame changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. | | `input` | This listener is triggered when the user changes the value of the IFrame. | ### User function The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both). - When used as an Input, the component only impacts the input signature of the user function. - When used as an output, the component only impacts the return signature of the user function. The code snippet below is accurate in cases where the component is used as both an input and an output. ```python def predict( value: str | None ) -> str | None: return value ```