class_docstr: Viewer implementation compatible with Vue 2 Trame Applications.
class_docstr_tok: ["Viewer","implementation","compatible","with","Vue","2","Trame","Applications","."]
docstr: Generate VContainer for PyVista Plotter.
  
  Parameters
  ----------
  mode : str, default: 'trame'
      The UI view mode. Options are:
  
      * ``'trame'``: Uses a view that can switch between client and server
        rendering modes.
      * ``'server'``: Uses a view that is purely server rendering.
      * ``'client'``: Uses a view that is purely client rendering (generally
        safe without a virtual frame buffer)
  
  default_server_rendering : bool, default: True
      Whether to use server-side or client-side rendering on-start when
      using the ``'trame'`` mode.
  
  collapse_menu : bool, default: False
      Collapse the UI menu (camera controls, etc.) on start.
  
  add_menu : bool, default: True
      Add a UI controls VCard to the VContainer.
  
  add_menu_items : callable, default: None
      Append more UI controls to the VCard menu. Should be a function similar to
      `Viewer.ui_controls()`.
  
  **kwargs : dict, optional
      Additional keyword arguments are passed to the view being created.
  
  Returns
  -------
  PyVistaRemoteLocalView, PyVistaRemoteView, or PyVistaLocalView
      Trame view interface for pyvista.
docstr_tok: ["Generate","VContainer","for","PyVista","Plotter",".","Parameters","--","--","--","--","--","mode",":","str",",","default",":","'trame'","The","UI","view","mode",".","Options","are",":","*","``","'trame","'","``",":","Uses","a","view","that","can","switch","between","client","and","server","rendering","modes",".","*","``","'server","'","``",":","Uses","a","view","that","is","purely","server","rendering",".","*","``","'client","'","``",":","Uses","a","view","that","is","purely","client","rendering","(","generally","safe","without","a","virtual","frame","buffer",")","default_server_rendering",":","bool",",","default",":","True","Whether","to","use","server-side","or","client-side","rendering","on-start","when","using","the","``","'trame","'","``","mode",".","collapse_menu",":","bool",",","default",":","False","Collapse","the","UI","menu","(","camera","controls",",","etc",".",")","on","start",".","add_menu",":","bool",",","default",":","True","Add","a","UI","controls","VCard","to","the","VContainer",".","add_menu_items",":","callable",",","default",":","None","Append","more","UI","controls","to","the","VCard","menu",".","Should","be","a","function","similar","to","`","Viewer.ui_controls","(",")","`",".","*","*","kwargs",":","dict",",","optional","Additional","keyword","arguments","are","passed","to","the","view","being","created",".","Returns","--","--","--","-","PyVistaRemoteLocalView",",","PyVistaRemoteView",",","or","PyVistaLocalView","Trame","view","interface","for","pyvista","."]
code: def ui(
      self,
      mode=None,
      default_server_rendering=True,
      collapse_menu=False,
      add_menu=True,
      add_menu_items=None,
      **kwargs,
  ):
      """Generate VContainer for PyVista Plotter.
  
      Parameters
      ----------
      mode : str, default: 'trame'
          The UI view mode. Options are:
  
          * ``'trame'``: Uses a view that can switch between client and server
            rendering modes.
          * ``'server'``: Uses a view that is purely server rendering.
          * ``'client'``: Uses a view that is purely client rendering (generally
            safe without a virtual frame buffer)
  
      default_server_rendering : bool, default: True
          Whether to use server-side or client-side rendering on-start when
          using the ``'trame'`` mode.
  
      collapse_menu : bool, default: False
          Collapse the UI menu (camera controls, etc.) on start.
  
      add_menu : bool, default: True
          Add a UI controls VCard to the VContainer.
  
      add_menu_items : callable, default: None
          Append more UI controls to the VCard menu. Should be a function similar to
          `Viewer.ui_controls()`.
  
      **kwargs : dict, optional
          Additional keyword arguments are passed to the view being created.
  
      Returns
      -------
      PyVistaRemoteLocalView, PyVistaRemoteView, or PyVistaLocalView
          Trame view interface for pyvista.
  
      """
      if mode is None:
          mode = self.plotter._theme.trame.default_mode
      if mode not in self.VALID_UI_MODES:
          raise ValueError(
              f"`{mode}` is not a valid mode choice. Use one of: {self.VALID_UI_MODES}"
          )
      if mode != "trame":
          default_server_rendering = mode == "server"
  
      with vuetify.VContainer(
          fluid=True,
          classes="pa-0 fill-height",
          style="position: relative",
          trame_server=self.server,
      ) as container:
          server = container.server
          # Initialize state variables
          server.state[self.EDGES] = False
          server.state[self.GRID] = (
              self.plotter.renderer.cube_axes_actor is not None
          )
          server.state[self.OUTLINE] = hasattr(
              self.plotter.renderer, "_box_object"
          )
          server.state[self.AXIS] = (
              hasattr(self.plotter.renderer, "axes_widget")
              and self.plotter.renderer.axes_widget.GetEnabled()
          )
          server.state[self.SERVER_RENDERING] = default_server_rendering
          if add_menu:
              server.state[self.SHOW_UI] = not collapse_menu
              with vuetify.VCard(
                  style="position: absolute; top: 20px; left: 20px; z-index: 1; height: 36px;",
                  classes=(f"{{ 'rounded-circle': !{self.SHOW_UI} }}",),
              ) as self.menu:
                  with vuetify.VRow(classes="pa-0 ma-0"):
                      button(
                          click=f"{self.SHOW_UI}=!{self.SHOW_UI}",
                          icon="mdi-dots-vertical",
                          tooltip=f"{{{{ {self.SHOW_UI} ? 'Hide' : 'Show' }}}} menu",
                      )
                      self.ui_controls(
                          mode=mode,
                          default_server_rendering=default_server_rendering,
                          v_show=(f"{self.SHOW_UI}",),
                      )
                      if callable(add_menu_items):
                          with vuetify.VRow(
                              v_show=(f"{self.SHOW_UI}",),
                              classes="pa-0 ma-0 align-center",
                          ):
                              add_menu_items()
          if mode == "trame":
              view = PyVistaRemoteLocalView(
                  self.plotter,
                  mode=(
                      # Must use single-quote string for JS here
                      f"{self.SERVER_RENDERING} ? 'remote' : 'local'",
                      "remote" if default_server_rendering else "local",
                  ),
                  **kwargs,
              )
          elif mode == "server":
              view = PyVistaRemoteView(self.plotter, **kwargs)
          elif mode == "client":
              view = PyVistaLocalView(self.plotter, **kwargs)
  
          self._html_views.add(view)
          view.menu = self.menu
  
      return view
  
file_path: pyvista/pyvista/trame/ui/vuetify2.py
imports: from trame.ui.vuetify2 import VAppLayout
  from trame.widgets import html, vuetify
  from trame_client.ui.core import AbstractLayout
  from pyvista.trame.views import PyVistaLocalView, PyVistaRemoteLocalView, PyVistaRemoteView
  from .base_viewer import BaseViewer
label_desc: Use image node_id 4 for calling the Viewer obj's underlying member method code with example usage: obj.ui(mode, default_server_rendering, collapse_menu, add_menu, add_menu_items) and returns: view