Homebrew: Table

From 5etools Community Wiki
Jump to: navigation, search

framless
v1.1.0

Building a table

As with any Homebrew item, make sure you have reviewed the _Meta section. If your file doesn't have it, it won't work.

Basic Skeleton

To start, copy the following code block and fill the "" values.

Table code block
 "table": [
    {
        "name": "",
        "source": "",
        "page": 0,
        "colLabels": [
            "Column 1",
            "Column 2"
        ],
        "rows": [
            [
                "This cell is row 1, column 1",
                "This cell is row 1, column 2"
            ],
            [
                "This cell is row 2, column 1",
                "This cell is row 2, column 2"
            ]
        ]
    }
]
  • "name" — The name of the Table.
  • "source" — Make sure it is the same as the "json" key in the _meta.
  • "page" — Page of the document the reward appears at (leave at 0 if not applicable).
  • "colLabel" — The label at the top of each column, ordered from first to last.
  • "rows" — The content of the cells in the table, each array belongs to a new row. There should be as many entries as columns in the table.


More options

Make sure you are adding these blocks in the same level as the "name", "source", etc.

Different styling

By default, tables will span their columns evenly and all text will be aligned to the left. This can be changed per-column basis, with the following code.

"colStyles": [
    "col-3 text-left",
    "col-9 text-right "
]
  • "col-x" — Determines the width of the column. Tables follow a 1-to-12 system, so col-12 will span 100% of the width, while col-6 is 50%, etc. As an extension to this method, you can also use 1/10th subdivisions can be used, e.g. col-1-5 for 1.5/12. The total column widths should still sum to exactly 12; enjoy doing the math.
  • "text-x" — Determines the text alignment of the column. The options are text-left, text-center and text-right.
  • It is also possible to use "bold" or "italic" in conjunction with the previous methods to change the column.

Rows can also be styled, if instead of an array, they are represented by an object:

"rows": [
    [
        "This cell is row 1, column 1",
        "This cell is row 1, column 2"
    ],
    {
        "type": "row",
        "style": "row-indent-first",
        "row": [
            "Rows may also be defined",
            "As objects with additional properties"
        ]
    }
]

Caption

A caption is a sort of title that will appear above the table.

"caption": "D100 Trinket Table"

Footer entries

This text will apear right below the table.

"footnotes": [
    "Reroll if you land a natural 20!."
]

Intro and outro text

This text will appear before and after the table.

"intro": [
    "Optional intro entries."
],
"outro": [
    "Optional outro entries."
]

Rollable Tables

By default, tables are made rollable if the label of the first column is a type of dice, like "d4", and the first cell of each row is a numeric value. It can either be a single number, or two numbers as a range of values (e.g. "1-3").

"colLabels": [
    "d6",
    "What you get"
],
"rows": [
    [
        "1",
        "A kick in the butt :("
    ],
    [
        "2-4",
        "A new shiny dagger"
    ],
    [
        "5-6",
        "My castle keys"
    ]
],


Reference Tag

How to link to entries within the strings

"{@action <table_name> | <json_source> | <optional_text_information>}":
{@table } assumed DMG as a json_source by default
Example:
 "Has a dusty {@table Adventuring Gear|phb} on the table"
 {@table 25 gp Art Objects}


Field List Table

The following is the list of fields that can be included in the object array, "sources". All fields are enclosed by quotation marks (").


Key Data Type Description Required
name String The name of the table. True
source String The JSON identifier, as seen in Homebrew: Meta. True
caption String Simmilar to the name field, appears above the table. False
intro String Text that precedes the table. False
outro String Text that succeeds the table. False
footnotes Array of entries This text is rendered right after the table, before the outro. False
colLabels Array of strings Title of each column False
rowLabels Array of strings Currently unused False
colStyles Array of strings Stylistic appearance of each column, both size and alignment. False
rowStyles Array of strings Stylistic appearance of each row, both size and alignment. False
rows Array of arrays of strings Where most of the data will be. Each row is an array, and each cell in that row is a string. True
style String Defines the style of the object it's in? Ask Giddy. False



🗄️ Reference Files:
[Requirements Specs (Schemata) ]
[[ |🧾 Blank Template]]
|📖 Sample JSON
Functional Example]
Repository of Other Examples

Homebrew Support


Known Issues
Looks like its perfect... (Did we miss anything?)


FAQ
Nothing's here (Do you have any suggestions?)
Best Practices
Quick Tip: You can use sites such as extracttable to quicken the process of converting tables from images and PDFs.



Related Features



Did that answer your question(s)?

If not please check the under Support; Troubleshooting or the Known Issues page for further guidance, or go to the Discord community and leave a comment in the issues channel.

If you enjoy the project, please follow this link to see how you can contribute and help make it even better.

Do you have time to take a Survey?