Patterns
Patterns are project schemas and, sometimes, data that can be used to create new TakeShape projects and enhance 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 a project
Patterns can also be applied to a project. When using the app.takeshape.io/add-to-takeshape?repo=<pattern url>
method, you'll have the opportunity to select a 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 a project. You can export a project in the following ways:
- Export using the web app (under Project Settings)
- Export using the CLI (instructions)
- Export using the API (instructions)
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 like#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: