Skip to main content

Image

The Image widget is used to display an image from your project's file system.

Widget Image
tip

To get started, simply drag and drop an image file of a common format (such as JPEG or PNG) into the notebook. Our system will automatically process the image and upload it to your current folder. Once the image is uploaded, you will see a new image widget displaying your image, which you can now move and customize.

Basic usage

First, you need to have an image file in your project. If you don't have any, go to your project's file explorer and go into any folder. Click the blue + button and select 'Upload files...'. Upload any image you want.

Now, create an Image widget. In the Path field, click the 'Open' button on the right to open the file picker. Select the image you just uploaded and accept. After picking the image, you should see its path inside the Path field input.

Save the widget, and the image will load inside.

API reference

Basic

Setting nameTypeDescriptionDefault
PathstringThe path to the image file.

Advanced

Setting nameTypeDescriptionDefault
AltstringThe alternative text for the image.
Enable fullscreen modebooleanWhether to enable a fullscreen mode to preview the image.true

Style

Setting nameTypeDescriptionDefault
Object fitstring/css_object_fitThe CSS object-fit property for the image. See CSS Object Fit.contain
Widthstring/css_sizeThe width of the image.100%
Heightstring/css_sizeThe height of the image.100%

Events

The Events settings let you trigger actions in response to clicks on the widget elements. When the event is activated, the current block and the subsequent blocks are executed.

Setting nameTypeDescriptionDefault
On eventnone | onClickWhether to activate the event onClick or notnone
Event variablestringName of the variable to store the data when the event is triggered

See also

  • All widgets — browse the full widget catalog.
  • Upload — let users provide the image files to display.