@rjsf/utils
Version:
Utility functions for @rjsf/core
11 lines (10 loc) • 768 B
TypeScript
import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema, Widget } from './types.js';
/** Detects whether the `widget` exists for the `schema` with the associated `registryWidgets` and returns true if it
* does, or false if it doesn't.
*
* @param schema - The schema for the field
* @param widget - Either the name of the widget OR a `Widget` implementation to use
* @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation
* @returns - True if the widget exists, false otherwise
*/
export default function hasWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, widget: Widget<T, S, F> | string, registeredWidgets?: RegistryWidgetsType<T, S, F>): boolean;