OneScript Docs

Widget View Node

Widget view node data structures.

Widget render functions return plain JavaScript objects called Widget view nodes.

Unsupported view types show a localized error message instead of rendering a blank widget.

Text

{
  type: "text",
  props: {
    text: "Hello Widget",
    padding: 12
  }
}
PropTypeDescription
textstringText content.
paddingnumber or edge objectOptional padding.

Image

{
  type: "image",
  props: {
    image: "image-token",
    resizable: true,
    scaledToFit: true,
    padding: {
      top: 12,
      left: 12,
      bottom: 12,
      right: 12
    }
  }
}
PropTypeDescription
imagestringInternal image token.
resizablebooleanAllows the image to resize.
scaledToFitbooleanScales the image to fit its bounds.
scaledToFillbooleanScales the image to fill its bounds.
paddingnumber or edge objectOptional padding.

Padding

Padding can be a number or an edge object.

12
{
  top: 12,
  left: 12,
  bottom: 12,
  right: 12
}

How is this guide?

Last updated on

On this page