Tags
Primitive Tags
The following tags are supported by pinc-lang and can be used to recieve data from outside of the component / page.
String
let text = #String();
Optional attributes:
key:stringlabel:stringinitialValue:stringrows:int(default1)richtext:bool(defaultfalse)
Returns:
string
Int
let amount = #Int();
Optional attributes:
key:stringlabel:stringinitialValue:intmin:intmax:intstep:int
Returns:
int
Float
let price = #Float();
Optional attributes:
key:stringlabel:stringinitialValue:floatmin:floatmax:floatstep:float
Returns:
float
Boolean
let checked = #Boolean();
Optional attributes:
key:stringlabel:stringinitialValue:bool
Returns:
bool
Array
let items = #Array(of: #String);
Returns:
array<any>
Required attributes:
of:tag
Optional attributes:
key:stringlabel:stringinitialSize:intmin:intmax:int
Record
let seo = #Record(of: {
title: #String,
description: #String(rows: 2),
});
Returns:
record<any>
Required attributes:
of:record
Optional attributes:
key:stringlabel:string
Slot
let footerContent = #Slot(key: "footer");
Required attributes:
key:string
Optional attributes:
key:stringlabel:stringmin:intmax:intconstraints:array<component constraints>
Returns:
array<Components>
Compiler Tags
The following tags are used to talk to the compiler to privide some functionality:
SetContext
Set a context value, which will be available to all components rendered as children of the current page / component.
let theme = #SetContext(key: "theme", value: theme);
Required attributes:
key:stringvalue:any
GetContext
Revieve a value of a previously set context.
let theme = #GetContext(key: "theme");
Required attributes:
key:string
Returns:
any
CreatePortal
Create a portal, where any other component or page can put values into.
let stylesheets = #CreatePortal(key: "stylesheets");
Returns:
array<any>
Portal
Push values into a portal. If no such portal exists, the push will be ignored.
#Portal(key: "stylesheets", push: <link rel="stylesheet" href="/css/Button.css" />);
Required attributes:
key:stringpush:any(except functions)
CMS Tags
The following Tags are provided by the cms and are used to get some cms specific data into the components:
Selection
let theme = #Selection(key: "theme", options: [
{ label: "Blue", value: "blue" },
{ label: "Red", value: "red" },
]);
Required attributes:
options:array<{ label: string, value: string }>
Optional attributes:
key:stringlabel:stringinitialValue:string
Returns:
string
MultiSelection
let fruits = #MultiSelection(key: "fruits", options: [
{ label: "Apple", value: "apple" },
{ label: "Orange", value: "orange" },
{ label: "Banana", value: "banana" },
{ label: "Melon", value: "melon" },
]);
Required attributes:
options:array<{ label: string, value: string }>
Optional attributes:
key:stringlabel:stringinitialValue:string
Returns:
array<string>
Image
let teaser = #Image(key: "teaser");
Optional attributes:
key:stringlabel:stringwidth:intheight:int
Returns:
{
src: string
alt: string
caption: string
width: int
height: int
}
Link
let url = #Link(key: "url");
Optional attributes:
key:stringlabel:string
Returns:
string
Tree
let mainNavigation = #Tree(key: "mainNavigation");
Optional attributes:
key:stringlabel:stringmaxLevels:intfilter:array<page constraints>
Returns:
{
type: string,
url: string,
active: bool,
inPath: bool,
children: array<this>,
instance: record
}