booleanValues
Prefer shorthand boolean attributes over explicit {true} values in JSX.
✅ This rule is included in the jsx stylistic presets.
When a boolean JSX attribute is set to true, the value can be omitted entirely.
The shorthand syntax is more concise and idiomatic in JSX, reducing visual noise and improving readability.
Examples
Section titled “Examples”<JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button ButtonHTMLAttributes<HTMLButtonElement>.disabled?: boolean | undefined
disabled={true}>Click me</JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button><JSX.IntrinsicElements.input: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
input InputHTMLAttributes<HTMLInputElement>.type?: HTMLInputTypeAttribute | undefined
type="text" InputHTMLAttributes<HTMLInputElement>.required?: boolean | undefined
required={true} /><const Component: any
Component isActive: boolean
isActive={true} />;<JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button ButtonHTMLAttributes<HTMLButtonElement>.disabled?: boolean | undefined
disabled>Click me</JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button><JSX.IntrinsicElements.input: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
input InputHTMLAttributes<HTMLInputElement>.type?: HTMLInputTypeAttribute | undefined
type="text" InputHTMLAttributes<HTMLInputElement>.required?: boolean | undefined
required /><const Component: any
Component isActive: true
isActive />;<JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button ButtonHTMLAttributes<HTMLButtonElement>.disabled?: boolean | undefined
disabled={false}>Explicit false is fine</JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button><const Component: any
Component isActive: any
isActive={const someCondition: any
someCondition} />;Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your project has an established style guide that prefers explicit boolean values for consistency or clarity, you may want to disable this rule. However, the shorthand syntax is widely accepted as idiomatic JSX.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Deno:
jsx-boolean-value - ESLint:
react/jsx-boolean-value
Made with ❤️🔥 around the world by
the Flint team and contributors.