Custom Statblock Templates | World Anvil Codex

Custom Statblock Templates

Restructuring the Codex

We are currently moving articles around and changing the general structure of the Codex. Please come back later if you get lost!

Guild Exclusive

This is a Grandmaster+ feature. To get access, Join the Worldbuilder's Guild!

An RPG block is a small piece data that displays information about an element of a role-playing game. It can be a character sheet, the statistics of an NPC/creature, or the properties of an item. In this guide, you will learn how to create new templates for RPG blocks. This feature is quite complex, but it also allows a great deal of flexibility and it can be used for any system.   Important note: this is not about how to create blocks and use them in articles, but about how to make your own custom block types. Please see Guide to blocks for the former.  

Getting started

Follow these steps to get started with your first block!  
  1. Make sure that you have selected an RPG system for your world. Any block template you create will be for one of the systems you have chosen for your world. You can set your world's RPG system from your world configuration.
  2. Click on the Studio option at the top menu bar, and choose Sheets & Blocks.
  3. On the right side of the page, you will see buttons to create sheets for your selected systems:
Block creation button
    In this guide, we will be creating and designing a character sheet for FATE Accelerated.  

Basic configuration

Basic details

When you click on the create button, this page will open:    
block creation basic details
  Enter the name of the block you are creating (e.g. "Character Sheet") and the description of the block (i.e. what's its purpose). If you check the JSON importer checkbox, people creating blocks from your template will be able to import blocks using JSON syntax. We have kept it unchecked in the example to avoid making it too complicated.   After filling both fields, click on the Create Template button!  

Parts configuration

Important Note If you are planning to create a custom form you won't need anything more than the name for each part, so just add the name and leave the type as one-liner string
  This page allows you to define the fields of your block. By default, the field Name is already configured as a required parameter and you can't edit it. To add a new field, use the form:    
block creation add field
  The only required information you need to provide is the name of the field. However, it's recommended you also add a description for the parameter and an example, so that people using the template know what the field is about. The right sidebar of the Parts configuration page contains a list and an explanation of all parameters.   Click on the Add template part button and the field will be saved. Repeat until you have entered all the field you need for the block. Don't worry about the design yet, for now just keep adding fields.   When you are finished, click on the Switch to display mode button you have at the top right corner of this page:  
block creation switch button

Display mode

In this page, you can design the block itself, how it will look when you create one. There are five text boxes:

Display structure

Use this box to specify how should the different parts of the sheet be displayed. You can arrange columns, headers, lists, and other elements using HTML and TWIG.

Styling sheet

Using CSS, you can make the sheet have a style that is more appropriate to the game or RPG system. This field has some limitations, currently. Mainly, using characters such as parenthesis () and commas (,) is not allowed (the CSS will not work). Also, do not use .user-css as a selector (as you would do in your world CSS), because the CSS will not be applied either. Make sure to choose unique class names for your HTML elements to avoid interferences between your custom CSS and the global World Anvil CSS.

Badge structure

This section, which also uses HTML and TWIG, can be used to design a shortened version of the sheet. By default, it will show in the sidebar of character journals.

Trackable form

Using HTML and TWIG, you can design a form that will allow your players to modify their character sheets/blocks from the view interface. Note that anyone with access to the article will be able to make modifications, so be careful!

Edit form

You can use this box if you want to change the layout of the edit interface for your block. This is an extremely advanced functionality, and we recommend not using it if it's not essential for the block.

Let's build a sheet!

This section is a step-by-step tutorial on how to create a basic character sheet. We will choose an RPG system with a simple character sheet: FATE Accelerated.

1. Creating the structure

World Anvil uses Bootstrap, which means that you can benefit from all bootstrap classes. This can be really useful, especially because you won't need to use CSS to create responsive columns (this is probably the most common application of this framework when creating RPG blocks).   All columns in Bootstrap must be enclosed inside a row class. Each row can have up to 12 columns, and you can either make the columns to be of equal width or to specify the exact width (using column numbers). For example, the following code will make three columns of equal width:  
<div class="row">
 <div class="col-md">
 Column 1 content
 </div>
 <div class="col-md">
 Column 2 content
 </div>
 <div class="col-md">
 Column 3 content
 </div>
</div>
  The -md suffix after col means that the columns will be applied to medium devices and larger. In order to specify the width of a column, use another suffix with a number, like in this example:   <div class="row"> <div class="col-md-9"> This column is as wide as nine single columns. </div> <div class="col-md-3"> This column is as wide as three nine single columns. </div> </div>     Of course, all regular HTML tags, like <h2></h2> and <b></b>, as well as custom classes, are also supported. In order to add the actual contents of the character sheet, we will need to use TWIG. Take a look at the quick TWIG reference in the sidebar!     The FATE Accelerated sheet has two columns of different width with a central box that takes the whole row. Each field is placed inside a box with a small gray label to identify the field. In order to do these boxes, we can use the following code:     <h2>Header</h2> <div class="fate-box"> <div class="fate-box-title">Box label</div> <div class="fate-points-number">Box value (using TWIG)</div> </div>   However, if you paste that code in the box without anything else, it won't look like we want it to. In order to give it proper styling, we need CSS.     See full character sheet

Jon Snow Smith

Jon Snow Smith is Lord Commander of the Night's Watch and a White Walker in disguise.

Aspects

High Concept
Lord Commander of the Night's Watch.
Trouble
I know nothing, or that's what my wildling girlfriend kept saying.
It's best to keep your enemies close.
Sometimes there is no happy choice, only one less grievous than the others
Don’t call me Lord Snow.
Refresh
4
Current Fate Points
3

Approaches

Careful

Clever

Flashy

Forceful

Quick

Sneaky

1
0
3
2
2
1

Stunts

Because I had a wildling girlfriend, it's easier for me to talk with them without them killing me on sight.

Stress

Stress score:

4/3

Consequences

Mild Consequence
whoa
Moderate Consequence
It's
Severe Consequence
test
   

2. Style it!

You can choose to leave the CSS box empty. In this case, the default CSS theme for the world will be applied to the sheet. This option is not recommended, as different worlds can have different themes, so the sheet might look bad in certain worlds.   With CSS, you have a great deal of control over the style of the block. There currently are some limitations, such as the fact that you can't import fonts or use certain characters for security reasons, but most CSS code should be fine. We can't possibly list the full list of CSS options here; you can check the w3 CSS page to learn CSS.     In order to style the box and headers that we added in the last section, we can use the following CSS:      
 h2 { 
 background: black; 
 color: white; 
 font-size: 25px; 
 padding: 5px; 
}
 .fate-box { 
 border: 2px solid black; 
 padding: 3px; 
 margin-bottom: 5px; 
}
 .fate-box .fate-box-title { 
 color: #A6A8AB; 
 font-size: 11px; 
}
 .fate-box .fate-box-content { 
 color: black; 
 font-size: 15px; 
}
   

3. Badge version

The badge is a shortened version of a block that contains only the essential information to understand it. It's completely optional, but if you have managed to create the basic sheet, the badge shouldn't be too difficult, as it uses the same kind of code as the basic one (HTML and TWIG).   Keep in mind that the badge should be designed to appear in the sidebar of articles (in fact, it will automatically appear in character journals), so try to avoid using too many columns. For FATE Accelerated, I decided to include only the most static information that summarizes their personality (i.e. the six approaches and the five aspects). However, unlike in the basic sheet, I put the six approaches side by side, in six different columns.   In order to embed the badge to any article, add "|badge" after the block id. For example: [block:45519|badge] will generate the block you can see at the right.

Jon Snow Smith

Careful
1
Clever
0
Flashy
3
Forceful
2
Quick
2
Sneaky
1

Aspects

High Concept
Lord Commander of the Night's Watch.
Trouble
I know nothing, or that's what my wildling girlfriend kept saying.
It's best to keep your enemies close.
Sometimes there is no happy choice, only one less grievous than the others
Don’t call me Lord Snow.
   

4. Trackable form (advanced!)

The trackable form lets you change the value of the fields of your sheet, so it is recommended to use for blocks like NPCs or character sheets. In order to build a trackable form, you can use HTML and TWIG (and style it with CSS), as in the previous section. This section, however, introduces a new HTML tag: <input>. This tag is the one you use in order to actually create the text boxes. You can use the following code as a guide for each field:  
 
<input
 placeholder="PLACEHOLDER"
 class="form-control" 
 type="string/number"
 value="CURRENT VALUE"
 name="FIELD NAME"
/>
Refresh
Fate Points

Consequences

Mild Consequence
Moderate Consequence
Severe Consequence

 

Stress

Stress score
      If the above is confusing, here you have a quick explanation of each field:      
  • placeholder: if you want the field to display a text that will disappear when you start typing in it, specify the text here. This is very useful for examples.
  • class: you can specify CSS classes here for more customization. If you want to keep thing simple, just leave it with the default "form-control" class, which will make the field have the default World Anvil CSS.
  • type: there are many types of inputs you can specify here. However, if you are just starting out, you just really need to know about "string" and "number". "string" will allow you to enter any kind of characters in the field, while "number" will limit it to numeric characters.
  • value: if you want the field to be already filled in when you load the page (for example, to display the current value of the field if it has already been filled in), use this field. You will need to use TWIG here. See below for an example and the sidebar for an explanation.
  • name: this field has no visible external effect, so just use the field name, replacing spaces with underscores and removing any special characters.
      The following examples show an input form for text and numbers respectively, taken from the FATE Accelerated character sheet:    
    You can embed the form if you add "|trackable" at the end of the block tag. For example: [block:45519|trackable]. Keep in mind that anyone with access to the article the form is embedded in will be able to use it and change your character sheet's data! If you want to have the form in a public article but avoid problems like that, you can put it in a secret and then embed the secret in the article.      

5. Edit form (advanced!)

For maximum customization, you can change the structure and style of the edit form for the character sheet (i.e. the page you or your players will use to create the character sheet from scratch). Keep in mind that if you decide to design it, you will need to design the full form, so you should use all fields here (and keep it updated if you add more in the future). This page uses HTML and TWIG (you can style it with CSS too). In order to create the text fields, you can use the same <input> tags we learned in the previous step.       As a tip, you can use the same structure of the basic sheet, so that users will be able to see the result of the sheet before saving. You can see the edit form for the FATE Accelerated character sheet if you add this RPG system to your World Configuration and create a new character sheet for this system.

Navigation

 

FAQ

Do I need to know programming?
Not really, but a basic level of HTML and CSS will be very useful. If you want to build a complex sheet, you will need to understand the scripting language TWIG.
 
I need more help!
This guide only covers the basics. Research the linked resources for more information. If you are stuckk with something come to the Discord and ask in the #twig-help channel.
 

See also

TWIG Template Filters
Generic article | Oct 29, 2023

Learn more about the useful TWIG filters that can be used in custom statblock templates.

 

Tillerz' Corner

 
Sheet Creation Check List
Generic article | May 25, 2023
Sheet List
Generic article | Oct 12, 2021
Useful Resources
Generic article | Mar 3, 2024

Useful things for worldbuilding.

TWIG reference

You can use TWIG to have more flexible customization. This quick reference contains the most basic usage of this language; if you want to learn more, you can use the official TWIG Documentation.   Have questions? Join our Discord server, sync your World Anvil and Discord accounts (you can do so from your World Anvil account settings), and use the #twig-help channel under the Help category.  

Variables

A variable is a word that has (or can have) a value assigned to it. In our case, variables are used to reference the different fields of the character sheet. When editing a sheet, there is a reference sidebar with the list of variables, but their name is basically the name of the field with underscores instead of spaces. For example, if you have a field called High Concept, the variable will be high_concept. You can use the following code to insert the value of a variable in your sheet:  
See example
  (Tip: click on the images to see them full-size.)  

Conditionals

More information...   Maybe you want to avoid displaying certain content if one of the fields is empty. To do so, you will have to check if the variable is defined. You can use a conditional, like that:  
  You can also have something else display if the field is empty:  
  See examples
These examples are taken from the FATE Accelerated character sheet.  
  The above will display the "Additional aspect 1" field (with HTML elements for structure and styling) if the user has filled it in. Otherwise, it won't display anything.  
  The above will display the "Current Fate Points" field (also with HTML for structure and styling) if the user has defined it. However, if the field is empty, it will display a 0 instead of the variable.
 

Operators

More information...   Operators are words or symbols that can be used to create more complex expressions. TWIG has many different operators, and if you want to learn all of them, click the "More information" link above. In this section we will only explain the operator used in the FATE Accelerated character sheet: ?:.   The operator is used in this way:  
  As you can see, it's kind of a shorthand for a conditional. In the FATE character sheet is used in input fields for the trackable and edit forms, in order to display the current value of the field:  
  In this example, when you load the page with the trackable form, the "Current Fate Points" field will already display the number of fate points that the character has. If the field is empty, it means that it has no points, so it will display a 0. Note that the 0 is inside simple quotation marks. If you want to make it display something that is not another variable, it should always be inside quotation marks, to tell the system that it's a string (i.e. "normal text").  

The magic of duplication

This guide has been using the character sheet for FATE Accelerated as an example. If you want to see how the full code for this sheet looks, you can duplicate its code by accessing the character sheet here: Jon Snow Smith. A duplicate of the template will automatically be added to your Studio and you will be able to edit it as you wish.   If you want to know how a more complex block is made (such as the DnD 5e character sheet), you can do the same to learn how complex TWIG is used

Comments

Please Login in order to comment!
Nov 19, 2019 19:38

Can you go into how the different value types work?

Nov 20, 2019 22:11

Hi! Can you elaborate? Which value are you referring to?

[they/them] Creator of Black Light, a science-fantasy universe.
Apr 18, 2020 16:12

I would like to see the "selection" value in particular. How do we use it in the form?

Nov 25, 2019 14:13

How do I connect a Character Sheet to my PCs? I'm setting up our world and campaign into WA and I'm testing different features, but I can't find how my PCs get a character sheet which I could access as well (mostly to attach blocks with Feat information). We're running a D&D 3.5 game. My PC's can create a D&D 5e sheet, but they don't have the option to create a 3.5 sheet as I do. I found an "old" reddit post about this ( https://www.reddit.com/r/WorldAnvil/comments/blm6gl/player_edited_character_sheets/ ) but the interface has apparently updated?

Nov 25, 2019 21:18

Hi! Please see this guide for the answer:  

Create A Player Character
Generic article | Oct 29, 2023

Learn how to create a player character for a campaign or any other endeavour.

  Feel free to ask any follow-up questions you might have! ^^

[they/them] Creator of Black Light, a science-fantasy universe.
Dec 3, 2019 21:31 by Simon Edge

How do I share a sheet that i've created for a game system?

Dec 4, 2019 09:41

The checkbox "Allow users to view the blocks' page directly and share it with the community." at the bottom of the block edit page should do the trick!

[they/them] Creator of Black Light, a science-fantasy universe.
Dec 4, 2019 12:17 by Simon Edge

Thanks!

Dec 5, 2019 03:45 by Liz

For the Edit Form section, how can we add a rich text editor? For a property of type text?

Dec 7, 2019 10:37

Hi! I'm not an expert at block templates so I asked Dimitris (the developer). He says that adding the class "mention" should do the trick!

[they/them] Creator of Black Light, a science-fantasy universe.
Apr 27, 2020 19:38 by Tillerz

add "mention" to it's class list, that will add the toolbar. :) ... class="form-control mention" ...

Apr 3, 2020 14:39

Is it somehow possible to store the value of an checkbox in the trackable field?

Check out my world World Behind the Veil!
Apr 3, 2020 20:47

No if you just use the regular HTML tag, but it is probably possible in other ways, so I recommend you join our Discord server and ask in #custom-articles-and-statblocks-help, the techies there will be able to help you!

[they/them] Creator of Black Light, a science-fantasy universe.
Apr 4, 2020 05:53

I did, will see. But I don't think it is possible. Since I can't move a value in HTML. So the only way this would be possible is to use JavaScript. Can I use JavaScript?

Check out my world World Behind the Veil!
Apr 9, 2020 12:40 by Gorkam Worka

Not you can't use JS.

Apr 27, 2020 19:40 by Tillerz

There is a way. ABOVE the input line for the checkbox, which sets "1" for checked, add an input line with type=hidden and value=0 and with the same name in name= and then it works. :)

Sep 28, 2020 20:37 by Cal Jameson

Hi. I must be an absolute moron. It says you don't need to know programming right at the top but I read this guide and I am completely lost. Is there a video tutorial out there? I feel like I need to "learn to code." Haha.

Sep 29, 2020 16:08

Hi! By programming, it meant programming languages like Python or C++. You will need to know HTML, CSS (which are not technically programming languages). As for TWIG, the third one that is used, you only need to learn it to do advanced stuff —this guide already explains the TWIG basics you need to create sheets.   If you're lost, I suggest you join our Discord community! We have a channel called #custom-articles-and-statblocks-help dedicated to questions on this subject. And don't feel bad, this is a hard thing to do!

[they/them] Creator of Black Light, a science-fantasy universe.
Sep 29, 2020 21:22 by Cal Jameson

Thanks so much for the response! I'll hop over to the Discord when I get back around to trying this :)

Nov 7, 2020 06:48

Has anyone by chance tried to do a Palladium or Rifts sheet ? Could I entice a Grand Master to do so?

Feb 6, 2021 01:05 by N. Phillip Cole

I'm a few months late to reply, but I just subbed to World Anvil for the explicit purpose of running Palladium and Rifts games. Did you ever work a sheet out? I'm just now taking all of this in and will probably take a stab at it in the coming weeks.

Jan 24, 2021 00:04

Is there any way to change the name of templates once they're built? When copying a template from an existing sheet, it always takes on the name of the existing sheet, and I can't figure out how to change the name.

Jan 24, 2021 20:17

Hi! You should be able to edit a template name from the page to edit the "display mode"

[they/them] Creator of Black Light, a science-fantasy universe.
Jan 25, 2021 09:59

Appreciated!

Mar 23, 2021 01:41

will the public see my character sheets?

Mar 25, 2021 12:38

That depends! If you embed your sheet on a public and published article, anyone visiting the article will be able to see the sheet on that article. Otherwise, statblocks are only visible directly if the Visibility checkbox is enabled (bottom of the editor page).   Note that if the character sheet is linked to the character using the Heroes suite and the character is public, the sheet will also be public in the "Sheet" tab.   Hope this helps, let me know if you need more clarification!

[they/them] Creator of Black Light, a science-fantasy universe.
Oct 16, 2021 02:45

I'd like to modify a character sheet that has already been made. I've tried "Duplicating" it, but that does not let me change the name of the block, making configuration management a nightmare and preventing me from identifying which block is the original and which is the one I'm trying to modify.   So I tried copying the block from the one I want to use as my base, but when I create a new template, I am unable to paste it.   What am I missing?

Oct 16, 2021 10:39

Hi! If you Duplicate the Block template you'll be redirected to a page to edit that block. If you Switch to Display Mode (button at the top right), you'll see an option to change the name of the template.   Let me know if that helps!

[they/them] Creator of Black Light, a science-fantasy universe.
Oct 17, 2021 07:31

That did it. Thank you.

Nov 27, 2021 11:26

How do you reference a statblock from the article (article to article is easy (@)) ... is there any shortcut, or do you have to go to stat and copy-paste the link?

Nov 28, 2021 11:20

When you view or edit a block there are two buttons, copy block and copy link, that appear at the bottom or top right of the block. You can click them to copy a code that will either embed the block or a link to the article. Since statblocks are not tied to a world, there's currently no way to reference them with the mention system.

[they/them] Creator of Black Light, a science-fantasy universe.
Dec 3, 2021 21:39

Thank you for a quick answer! :)

Jan 16, 2022 20:14

In the block template CSS field, when I paste the value below it does not change the background of the statblock when the block is embedded in an article; however, if i paste the same value in the custom css area in the "world styling editor" on the article directly it works. Any ideas as to how I can get it to work in template css?   .statblock{background: #000000;padding:20px;solid;position:relative;}   Thank you

Jan 17, 2022 10:44

Hi! The CSS you added seems to have a syntax error. It should be:   .statblock{background: #000000;padding:20px;position:relative;}   (I've removed a "solid;" that wasn't properly formatted)   Does this work?

[they/them] Creator of Black Light, a science-fantasy universe.
Jan 18, 2022 04:20

Thank you for the reply, but when added to the CSS for the block template it does not make any visual changes to the appearance of statblocks made with that template and embedded into articles.   However, If I go into each article, and add either code to the world styling editor it works....

Jul 20, 2022 02:39

I think you're running into the same issue I am. The CSS preprocessor being used is pre-pending a unique block class to the front of all your css-rules. In theory this is a good thing however since the exact same class is being used on both the display and on the editor it means any style changes you successfully make to the statblock element being displayed would ALSO apply when the stat block is being edited. which is super annoying. Anywho in your specific case you can just remove the selector entirely and put the { background-color: black; padding: 20px } and it'll render fine, just be mindful that the top level selector applies to multiple places.... grrrrr