The CustomPageContext
interface provides a set of properties to interact with the current page within your custom app. This allows you to manipulate titles, badges, visibility, and components on the fly.
Declaration
Copy const currentPage : CustomPageContext
Interface
Copy interface CustomPageContext {
get title () : string ;
get badge () : string ;
get isHidden () : boolean ;
get components () : { [componentTagName : string ] : CustomPageComponents }
}
// all component interfaces below
type CustomPageComponents = TextComponent | BooleanInputComponent | ...
Component Tag
Each component within a custom page can be accessed by its unique tag name, available in the editor.
Example Usage To fetch the text of a component tagged as largeHeading, use:
Copy // example usage:
const largeHeadingText = currentPage . components . largeHeading .text
Components Interfaces
Properties not marked with get (read-only) can be changed. For example, you can change text styles when the user taps a button.
Text
Copy type TextStyle = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "paragraph"
type TextAlignment = "leading" | "center" | "trailing"
interface TextComponent {
get text () : string ;
get isHidden () : boolean ;
get tag () : string ;
style : TextStyle ;
alignment : TextAlignment ;
}
Boolean Input
Copy interface BooleanInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
value : boolean ;
}
Date Time Input
Copy interface DateTimeInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
value : Date ;
mode : "date" | "dateAndTime" ;
}
Number Input
Copy interface NumberInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
value : number ;
}
Text Input
Copy interface TextInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
value : string ;
}
Options Input
Copy interface OptionsInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
availableOptions : string [];
selectedOptions : string [];
style : "list" | "chip" ;
allowMultipleSelection : boolean ;
}
Barcode Input
Copy interface BarcodeInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
value : string ;
allowedBarcodeTypes : BarcodeType [];
}
type BarcodeType =
| "qr"
| "code39"
| "code128"
| "code93"
| "ean-13"
| "ean-8"
| "jan"
| "upc-e"
| "upc-a"
| "code11" ;
Attachment Input
Copy interface File {
get name () : string
get uploadedUrl () : string | undefined
get size () : number
get mimeType () : string
}
interface AttachmentInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get value () : File [];
}
Multi Line Text Input
Copy interface MultiLineTextInputComponent {
get isHidden () : boolean ;
get tag () : string ;
get disabled () : boolean ;
get label () : string | undefined ;
value : string ;
}
Markdown
Copy interface MarkdownComponent {
get isHidden () : boolean ;
get tag () : string ;
get markdown () : string | undefined ;
}
Audio
Copy interface AudioComponent {
get isHidden () : boolean ;
get tag () : string ;
get audioUrl () : string | undefined ;
get title () : string | undefined ;
get subtitle () : string | undefined ;
get artworkUrl () : string | undefined ;
get isPlaying () : boolean ;
pause () : boolean ;
resume () : boolean ;
stop () : boolean ;
}
Image
Copy interface ImageComponent {
get isHidden () : boolean ;
get tag () : string ;
get imageUrl () : string | undefined ;
ratio : {
width : number ;
height : number ;
};
}
Video
Copy interface VideoComponent {
get isHidden () : boolean ;
get tag () : string ;
get videoUrl () : string | undefined ;
get thumbnailUrl () : string | undefined ;
get title () : string | undefined ;
}
File Preview
Copy interface FilePreviewComponent {
get isHidden () : boolean ;
get tag () : string ;
get fileUrls () : string [];
}
Maps
Copy interface MapsComponent {
get isHidden () : boolean ;
get tag () : string ;
get mapsUrl () : string | undefined ;
}
Web Link
Copy interface WebLinkComponent {
get isHidden () : boolean ;
get tag () : string ;
get url () : string | undefined ;
}
Inline Collection
Copy interface InlineCollectionComponent {
get isHidden () : boolean ;
get tag () : string ;
}
Repeater
Copy interface RepeaterComponent {
get isHidden () : boolean ;
get tag () : string ;
direction : "vertical" | "horizontal" ;
}
Copy interface BarcodeComponent {
get isHidden () : boolean ;
get tag () : string ;
get title () : string | undefined ;
get barcodeValue () : string | undefined ;
get barcodeType () : BarcodeType ;
}
Progress
Copy interface ProgressComponent {
get isHidden () : boolean ;
get tag () : string ;
get title () : string | undefined ;
get value () : number ;
get maxValue () : number ;
get minValue () : number ;
style : "bar" | "ring" | "rating" ;
}
Charts
Copy interface ChartComponent {
get isHidden () : boolean ;
get tag () : string ;
}
Callout
Copy interface CalloutComponent {
get isHidden () : boolean ;
get tag () : string ;
get title () : string | undefined ;
get message () : string | undefined ;
style : "success" | "warning" | "error" | "info" ;
}
Table
Copy interface TableComponent {
get isHidden () : boolean ;
get tag () : string ;
get name () : string | undefined ;
get items () : Record < string , string >[];
}
Links
Copy interface Link {
get isHidden () : boolean ;
get tag () : string ;
get label () : string | undefined ;
get websiteUrl () : string | undefined ;
get pageId () : string | undefined ;
}
interface LinksComponent extends Component {
style : "list" | "grid" ;
get links () : Link [];
}
Button
Copy interface ButtonComponent {
get isHidden () : boolean ;
get tag () : string ;
get title () : string | undefined ;
style : "filled" | "outline" | "tinted" | "plain" ;
role : "default" | "destructive" ;
size : "fit" | "fill" ;
}
Last updated 9 months ago