FieldFormatter
This is a React component

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

For the given Field and value render the relevant Formatter for it.

Usage of this component requires UiProvider to appear somewhere above it in the component hierarchy. You must pass the getFormatterForField prop through which is what determines which component to use for a specific field.

getFormatterForField can return either a component directly or a 2-element array of the component and some props to pass through to it. FieldFormatter handles rendering the returned component and passing through any extra props returned from getFormatterForField or passed through to Formatter.

ParameterTypeDescription
*props.fieldField

The field used to determine the formatter to use. If field is bound to the record then value is not required and will be set to field.value.

props.valueFieldValueT

Value to format. If field is a record bound field then this is not required.

Examples