BooleanFormatter
This is a React component

Source
import { BooleanFormatter } from "@prestojs/ui";
BooleanFormatter(props)

Format a boolean for display

Displays truthy value as Yes, falsy as No and null/undefined/empty string as blankLabel (defaults to empty string).

This is the default formatter used for BooleanField and NullableBooleanField.

ParameterTypeDescription
props.blankLabelReactNode

Rendered when value is null or undefined

Defaults to empty string

props.falseLabelReactNode

Rendered when value is falsy but not null, undefined or the empty string

Defaults to No

props.trueLabelReactNode

Rendered when value is truthy

Defaults to Yes

props.valueboolean|null

The value to format. When null, undefined or empty string it renders blankLabel, when truthy renders trueLabel, when falsy renders falseLabel

Examples