Developer Wiki

In-depth guide for developers to create stencils and templates

Collection Properties

Shapes in a collection tend to have the same style such as same font, color, stroke style... To be convenient to stencil authors in this situation, Pencil supports grouping all shapes common style to collection style. These collection properties can be used as the default value for stencil properties. Then if collection style is changed, default property values for shapes will be changed accordingly.

Have a look at this example. Collection properties are defined and then used in shape properties.

<Shapes ...>
    <PropertyGroup name="Text">
      <Property name="defaultTextFont"
                displayName="Default Font">Arial|normal|normal|13px</Property>
      <Property name="defaultTextColor"
                displayName="Default Text Color">#000000ff</Property>
  <Shape id="helloworld" displayName="Hello World" icon="Icons/plain-text.png">
      <PropertyGroup name="Text">
        <Property name="label"
                  type="PlainText">Hello World</Property>
        <Property name="textColor"
        <Property name="textFont"


    <p:Content xmlns:p="" xmlns="">
      <text id="text" />


Text content inside the <Property> tag of a stencil is the literal presentation of the initial value for that property. In this example you can notice that the content inside that tag is a <E></E> instead. This is the notation to imply that the initial value should be obtained by evaluation the 'expression' inside the <E> tag. To reference a specific collection property in side this expression, the $$ syntax is used.