Using ShortcutsΒΆ

A stencil may contain many properties. When a shape is dragged onto the canvas, each property is assigned its default value. It is often useful to be able to provide several variations of a shape, each with different default property values. Pencil supports this through shortcuts, which allow a stencil to be linked to by any number of shortcuts stencils, with each shortcut specifying its own default property values.

<Shape id="label" displayName="Label" icon="Icons/plain-text.png">
        <PropertyGroup name="Text">
            <Property name="label" displayName="Label" type="PlainText">Hello World</Property>
            <Property name="textColor" displayName="Color" type="Color">#808080ff</Property>
            <Property name="shadowColor" displayName="Shadow Color" type="Color">#008000ff</Property>
            <Property name="textFont" displayName="Font" type="Font">Arial,sans-serif|normal|normal|13px</Property>
            <Property name="shadow" displayName="Width Shadow" type="Bool">false</Property>
        <For ref="text">
                <Arg>new Bound(0, 0, 100, 12)</Arg>
                <Arg>new Alignment(0, 1)</Arg>
        <For ref="shadow">
                <Arg>new Bound(1, 1, 100, 12)</Arg>
                <Arg>new Alignment(0, 1)</Arg>
    <p:Content xmlns:p="" xmlns="">
        <text id="shadow" />
        <text id="text" />

<Shortcut displayName="Label with shadow" icon="Icons/label-shadow.png" to="label">
    <PropertyValue name="shadow">true</PropertyValue>

Here, a shortcut is created to the label stencil, with the shortcut overriding the default value of the label’s shadow property. All properties can be changed using this method. The to attribute should be equal to the target shape’s id.

A shortcut may refer to a stencil from another collection. In this situation, the to property needs to be in the form of collectionid:shapeId.

<Shortcut displayName="name" icon="" to="collectionId:shapeId">
    <!-- ... -->


Due to limitations in Pencil, the referenced collection needs to be loaded first otherwise the shortcut will not work.