Skip to content

Primitive Components

Gokhan Kurt edited this page Feb 7, 2021 · 5 revisions

In addition to their specific properties, all the primitive components also support style, layout and events. Use Typescript to discover more about the properties of a component.

view

View is the most basic component. It acts as a container that groups other components together.

view

button

A clickable view.

button

scroll

Scroll is like View, but it will show a scrollbar when its content overflows it in size.

text

Text is a special component that can only have literal text as children. It is for advanced use cases where you need a ref to the text component.

input

Input is used to show editable text fields. It cannot have children.

Supported properties:

  • value: Initial value of the field
  • placeholder: The placeholder text to show when field is empty
  • readonly: Is the field editable
  • onReturn: Callback for when enter key or other submit keys are pressed
  • onChange: Callback for when the value has changed

input

image

Image is used to render a texture/sprite.

Supported properties:

  • source: The sprite to be rendered
  • fit: How the sprite will fit into the containing view
  • tint: The tint color of sprite

image

toggle

Toggle is used to show a toggle field, checkbox in other words. It cannot have children.

Supported properties:

  • value: Initial boolean value for on/off
  • onChange: Callback for when the value has changed

toggle