Private betav0.3.0
DocsSign in
Format developer documentation

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-docs
pnpm dlx format new project ./my-docs
yarn dlx format new project ./my-docs
bun x format new project ./my-docs

Reference

directoryType argumentWhere to create the project. Prompted if omitted.
--frameworkType "react" | "vue" | "html"The framework to build your documents with.
--no-installType booleanDefault trueDon't install dependencies after creating the project.Negation flag: default is true. Passing --no-install sets this to false.
-y, --yesType booleanDefault falseSkip 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 invoice
pnpm dlx format new document invoice
yarn dlx format new document invoice
bun x format new document invoice

You 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 tailwind
pnpm dlx format new document invoice --styling tailwind
yarn dlx format new document invoice --styling tailwind
bun x format new document invoice --styling tailwind

Reference

nameThe document directory name (kebab-case recommended). Omit it to be prompted with a random suggestion.
Type
argument
--stylingStyling method for the document. Choices are filtered to your project framework. See the styling docs for more information.
Type
"css" | "css-modules" | "vue-sfc-scoped" | "scss" | "tailwind" | "linaria" | "vanilla-extract" | "panda-css"
Default value
css
--schemaScaffold 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.
Type
"none" | "zod" | "valibot" | "joi" | "yup"
Default value
none
--dataPath to a JSON file to seed the default data variant. Its shape is used to infer the schema and the entry's data type.
Type
string
--sizePage size for the document. A4 is the default; pass "custom" with --width and --height for an exact size.
Type
"a3" | "a4" | "a5" | "letter" | "slide-16-9" | "slide-4-3" | "custom"
Default value
a4
--widthCustom page width in CSS pixels. Requires --height; ignored unless --size is "custom" or omitted.
Type
string
--heightCustom page height in CSS pixels. Requires --width; ignored unless --size is "custom" or omitted.
Type
string
--no-installDon't install missing styling/schema dependencies after creating the document.
Type
boolean
Default value
true
Note
Negation flag: default is true. Passing --no-install sets this to false.
-y, --yesSkip all prompts and use the defaults for every option that isn't provided.
Type
boolean
Default value
false
--emptyScaffold the most minimal document. Can be combined with other flags.
Type
boolean
Default value
false
Was this page helpful?