Documentation

Lean.Widget.UserWidget

  • Sourcetext of the code to run.

    sourcetext : String

A custom piece of code that is run on the editor client.

The editor can use the Lean.Widget.getWidgetSource RPC method to get this object.

See the manual entry above this declaration for more information on how to use the widgets system.

Instances For
    • Pretty name of user widget to display to the user.

      name : String
    • An ESmodule that exports a react component to render.

      javascript : String

    Use this structure and the @[widget] attribute to define your own widgets.

    @[widget]
    def rubiks : UserWidgetDefinition :=
      { name := "Rubiks cube app"
        javascript := include_str ...
      }
    
    Instances For
      Instances For
        Equations

        Input for getWidgetSource RPC.

        Instances For
          Equations
          • One or more equations did not get rendered due to their size.

          Try to retrieve the UserWidgetInfo at a particular position.

          Equations
          • One or more equations did not get rendered due to their size.
          • Arguments to be fed to the widget's main component.

            props : Lean.Json
          • The location of the widget instance in the Lean file.

          UserWidget accompanied by component props.

          Instances For

            Get the UserWidgets present at a particular position.

            Equations
            • One or more equations did not get rendered due to their size.
            def Lean.Widget.saveWidgetInfo {m : TypeType} [inst : Monad m] [inst : Lean.MonadEnv m] [inst : Lean.MonadError m] [inst : Lean.Elab.MonadInfoTree m] (widgetId : Lean.Name) (props : Lean.Json) (stx : Lean.Syntax) :

            Save a user-widget instance to the infotree. The given widgetId should be the declaration name of the widget definition.

            Equations

            Widget command #

            Use #widget to display a widget. Useful for debugging widgets.

            Equations
            • One or more equations did not get rendered due to their size.
            Equations
            • One or more equations did not get rendered due to their size.