Prettier config generator and playground

Loading Prettier latest…

Prettier options reference

Every option below is available in the generator above. Defaults shown are from Prettier 3.9.6.

bracketSameLineBracket Same Line

where the closing angle bracket of a multi-line tag lands

Default
false
CLI flag
--bracket-same-line

bracketSpacingBracket Spacing

the spaces inside object braces, and everywhere they follow

Default
true
CLI flag
--no-bracket-spacing

objectWrapObject Wrap

Prettier's one deliberate escape hatch, and how to switch it off

Default
"preserve"
CLI flag
--object-wrap
Allowed values
preservecollapse

proseWrapProse Wrap

how Markdown paragraphs are wrapped, and why the default leaves them alone

Default
"preserve"
CLI flag
--prose-wrap
Allowed values
alwaysneverpreserve

singleAttributePerLineSingle Attribute Per Line

one attribute per line, for markup diffs that read like code diffs

Default
false
CLI flag
--single-attribute-per-line

singleQuoteSingle Quote

a preference Prettier overrides whenever escaping would suffer

Default
false
CLI flag
--single-quote

embeddedLanguageFormattingEmbedded Language Formatting

formatting the CSS, HTML and GraphQL hiding inside your template literals

Default
"auto"
CLI flag
--embedded-language-formatting
Allowed values
autooff

endOfLineEnd Of Line

line endings, and the Windows diff problem this option was created to end

Default
"lf"
CLI flag
--end-of-line
Allowed values
lfcrlfcrauto

printWidthPrint Width

the width Prettier aims for, not a hard limit

Default
80
CLI flag
--print-width

tabWidthTab Width

how wide one indentation level is, in columns

Default
2
CLI flag
--tab-width

useTabsUse Tabs

tabs for indentation, and why accessibility is the strongest argument

Default
false
CLI flag
--use-tabs

htmlWhitespaceSensitivityHtml Whitespace Sensitivity

the option that stops Prettier changing how your page renders

Default
"css"
CLI flag
--html-whitespace-sensitivity
Allowed values
cssstrictignore

vueIndentScriptAndStyleVue Indent Script And Style

whether a Vue SFC indents inside its script and style blocks

Default
false
CLI flag
--vue-indent-script-and-style

arrowParensArrow Parens

parentheses around a lone arrow parameter, and the edit cost of leaving them off

Default
"always"
CLI flag
--arrow-parens
Allowed values
alwaysavoid

experimentalOperatorPositionExperimental Operator Position

whether a wrapped operator trails the line above or leads the line below

Default
"end"
CLI flag
--experimental-operator-position
Allowed values
startend

experimentalTernariesExperimental Ternaries

an opt-in answer to Prettier's longest-running formatting argument

Default
false
CLI flag
--experimental-ternaries

jsxSingleQuoteJsx Single Quote

quote style for JSX attributes, kept separate from your JavaScript strings

Default
false
CLI flag
--jsx-single-quote

quotePropsQuote Props

when object keys get quoted, and the consistency option most people want

Default
"as-needed"
CLI flag
--quote-props
Allowed values
as-neededconsistentpreserve

semiSemi

semicolons, and the ASI hazards behind the default

Default
true
CLI flag
--no-semi

trailingCommaTrailing Comma

the option that exists to make diffs smaller

Default
"all"
CLI flag
--trailing-comma
Allowed values
alles5none

checkIgnorePragmaCheck Ignore Pragma

lets a file opt itself out of formatting entirely

Default
false
CLI flag
--check-ignore-pragma

cursorOffsetCursor Offset

the option that stops format-on-save losing your place

Default
-1
CLI flag
--cursor-offset

insertPragmaInsert Pragma

stamps a @format marker on every file Prettier formats

Default
false
CLI flag
--insert-pragma

rangeEndRange End

the exclusive end of a partial format

Default
CLI flag
--range-end

rangeStartRange Start

the start of a partial format, and how Format Selection actually works

Default
0
CLI flag
--range-start

requirePragmaRequire Pragma

the option that lets a huge codebase adopt Prettier one file at a time

Default
false
CLI flag
--require-pragma