format new
Scaffold a new Format project or document.
Use format new to create a completely fresh new Format project or add new Format documents to existing projects.
If you are looking to add Format to an existing repo with an existing package.json, you should use format init.
Create a project
npx format new project ./my-docspnpm dlx format new project ./my-docsyarn dlx format new project ./my-docsbun x format new project ./my-docsReference
| Name | Description |
|---|---|
directory | Where to create the project. Prompted if omitted. |
--framework | The framework to build your documents with. |
--no-install | Don't install dependencies after creating the project. |
-y, --yes | Skip all prompts and use the defaults for every option that isn't provided. |
Create a document
Run it with a name, or omit the name to be prompted with a random suggestion.
npx format new document invoicepnpm dlx format new document invoiceyarn dlx format new document invoicebun x format new document invoiceYou will be prompted on your initial page size, what styling library you would like to use, whether to use a schema and any dynamic data you want to start with.
The framework (React, Vue or HTML) will be inferred from your config.
All the prompts can be controlled automatically via the flags documented below. For example, the following would preset Tailwind as the styling library, but prompt for the remaining options.
npx format new document invoice --styling tailwindpnpm dlx format new document invoice --styling tailwindyarn dlx format new document invoice --styling tailwindbun x format new document invoice --styling tailwindReference
| Name | Description |
|---|---|
| The document directory name (kebab-case recommended). Omit it to be prompted with a random suggestion. | |
| Styling method for the document. Choices are filtered to your project framework. See the styling docs for more information. | |
Scaffold a data/schema.ts with this validation library, or "none" for no schema. Format validates any Standard Schema compliant library, so you can also wire up others by hand. | |
| Path to a JSON file to seed the default data variant. Its shape is used to infer the schema and the entry's data type. | |
| Page size for the document. A4 is the default; pass "custom" with --width and --height for an exact size. | |
| Custom page width in CSS pixels. Requires --height; ignored unless --size is "custom" or omitted. | |
| Custom page height in CSS pixels. Requires --width; ignored unless --size is "custom" or omitted. | |
| Don't install missing styling/schema dependencies after creating the document. | |
| Skip all prompts and use the defaults for every option that isn't provided. | |
| Scaffold the most minimal document. Can be combined with other flags. |
Details
[name]
argument--styling <method>
"css" | "css-modules" | "vue-sfc-scoped" | "scss" | "tailwind" | "linaria" | "vanilla-extract" | "panda-css"css--schema <library>
data/schema.ts with this validation library, or "none" for no schema. Format validates any Standard Schema compliant library, so you can also wire up others by hand."none" | "zod" | "valibot" | "joi" | "yup"none--data <path>
string--size <id>
"a3" | "a4" | "a5" | "letter" | "slide-16-9" | "slide-4-3" | "custom"a4--width <px>
string--height <px>
string--no-install
booleantrue--no-install sets this to false.-y, --yes
booleanfalse--empty
booleanfalse