{"library":"shinywidgets","title":"Shiny Widgets Integration","description":"shinywidgets facilitates the rendering and interactive use of `ipywidgets` within `Shiny for Python` applications. It bridges the gap between the rich interactive capabilities of `ipywidgets` and the reactive framework of Shiny, allowing users to embed existing widget ecosystems like `ipyleaflet`, `plotly.graph_objects.FigureWidget`, and `ipyvolume` directly into their Shiny apps. The current version is 0.8.0, with a fairly active release cadence, often addressing compatibility with new versions of `ipywidgets`, `plotly`, and `websockets`.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install shinywidgets","pip install shinywidgets ipywidgets ipyleaflet"],"cli":null},"imports":["from shinywidgets import output_widget","from shinywidgets import render_widget"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from shiny import App, ui, render\nfrom shinywidgets import output_widget, render_widget\nimport ipywidgets as widgets\n\napp_ui = ui.page_fluid(\n    ui.h2('Shiny + ipywidgets'),\n    output_widget('my_slider'),\n    ui.output_text('slider_value'),\n)\n\ndef server(input, output, session):\n    @render_widget\n    def my_slider():\n        return widgets.IntSlider(min=0, max=100, value=50, description='Slider:')\n\n    @output\n    @render.text\n    def slider_value():\n        return f'Slider value: {input.my_slider()}'\n\napp = App(app_ui, server)","lang":"python","description":"This example demonstrates how to integrate an `ipywidgets.IntSlider` into a Shiny application. The `output_widget` function creates a placeholder in the UI, and the `@render_widget` decorator on the server side defines the `ipywidget` to be rendered. The widget's value can be accessed via `input.widget_id()` just like standard Shiny inputs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}