Skip to main content

Patterns

Patterns are project schemas and, sometimes, data that can be used to create new TakeShape projects and enhance existing ones. Projects make it easy to share new functionality with your other projects, or with the world!

We maintain a repository of patterns on GitHub at takeshape/patterns. If you'd like to add a pattern to it, you can make a pull request against it for consideration by the TakeShape team.

Using patterns

Create a new project

Patterns can be used to create a new TakeShape project. Navigate to app.takeshape.io/add-to-takeshape?repo=<pattern url>, replacing <pattern url> with the URL for a pattern you'd like to base your project on.

Enhance an existing project

Patterns can also be applied to an existing project. When using the app.takeshape.io/add-to-takeshape?repo=<pattern url> method, you'll have the opportunity to select an existing project to apply the pattern to.

You can also find new patterns to apply from within your project schema. In the left sidebar, we provide a list of patterns available in the public takeshape/patterns repository.

Creating patterns

The easiest way to create a pattern is by exporting an existing project. You can export a project in the following ways:

What files are in a Pattern?

schema.json (example)

The heart of the Pattern. This file describes the Shapes (content types) that make up the Pattern.

Schemas may also be defined in yaml with the .yaml or .yml extensions.

pattern.yml (example)

The metadata describing the Pattern. This information will help people know what a Pattern is useful for. The following fields are supported:

  • name (string)
  • description (string)
  • icon (string -- any valid feather icon name)
  • color (string -- a six digit hexadecimal color such as #6235BF)
  • categories (sequence of strings)

Pattern metadata files may also be defined in json with the .json extension.

data.jsonl optional (example)

The optional example content of the Pattern. This content will fit the schema described in schema.json.

roles.yml optional (example)

A file describing roles and permissions for your pattern. This file may be the result of a project export, or a file you author explicitly for your pattern.

This file can also be defined in json with the .json extension.

Sharing patterns

Using a URL

You can share a pattern by sharing a URL of this format:

https//app.takeshape.io/add-to-takeshape?repo=https://github.com/takeshape/takeshape-samples/tree/master/shape-books

Replace the repo parameter with the URL of your repository.

Using a button in your README

You can also add a nice Deploy To TakeShape button to the README in your repository. Here are the instructions. The button looks like this: