surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.02k stars 785 forks source link

Introduce an API to override a default renderer for all questions of a specific type #8234

Closed andrewtelnov closed 2 months ago

andrewtelnov commented 2 months ago

IMPLEMENTED

The registerRenderer method now has a Boolean parameter—useAsDefault. Pass true if you want to use the renderer you are registering as a default renderer for questions of a specifed type:

import { RendererFactory } from "survey-core";

// ...

RendererFactory.Instance.registerRenderer(
    "radiogroup",
    "radiogroup-with-image",
    "sv-radiogroup-with-image",
    true // Use "sv-radiogroup-with-image" as a default renderer for questions of a "radiogroup" type
);

View Demo