Skip to main content

useQueryBuilderSchema()

useQueryBuilderSchema<RG, F, O, C>(props, setup): object

For given QueryBuilderProps and setup values from useQueryBuilderSetup, prepares and returns all values required to render a query builder.

Type Parameters

Type Parameter
RG extends RuleGroupTypeAny
F extends FullField<string, string, string, Option<string>, Option<string>>
O extends FullOperator<string>
C extends FullCombinator<string>

Parameters

ParameterType
propsQueryBuilderProps<RG, F, O, C>
setupobject
setup.combinatorsWithUnknownIndex<BaseOption<string> & FullOption<string>>[] | OptionGroup<WithUnknownIndex<BaseOption<string> & FullOption<string>>>[]
setup.createRule() => GetRuleTypeFromGroupWithFieldAndOperator<RG, F, O>
setup.createRuleGroup(independentCombinators?) => RG
setup.fieldMapFullOptionMap<FullField<string, string, string, Option<string>, Option<string>>, GetOptionIdentifierType<F>>
setup.fieldsFullOptionList<F>
setup.getInputTypeMain(field, operator, __namedParameters) => InputType
setup.getOperatorsMain(field, __namedParameters) => FullOptionList<O>
setup.getRuleDefaultOperator(field) => GetOptionIdentifierType<O>
setup.getRuleDefaultValue<RT>(r) => any
setup.getValueEditorTypeMain(field, operator, __namedParameters) => ValueEditorType
setup.getValueSourcesMain(field, operator) => ValueSources
setup.getValuesMain(field, operator, __namedParameters) => WithUnknownIndex<BaseOption<string> & FullOption<string>>[] | OptionGroup<WithUnknownIndex<BaseOption<string> & FullOption<string>>>[]
setup.qbIdstring
setup.rqbContextUseMergedContextReturn<F, GetOptionIdentifierType<O>>

Returns

object

actions

actions: QueryActions

combinatorPropObject

combinatorPropObject: Pick<RuleGroupProps<FullOption<string>, string>, "combinator">

dndEnabledAttr

dndEnabledAttr: string

inlineCombinatorsAttr

inlineCombinatorsAttr: string

queryDisabled

queryDisabled: boolean

rootGroup

rootGroup: RuleGroupTypeAny<GetRuleTypeFromGroupWithFieldAndOperator<RG, F, O>>

rootGroupDisabled

rootGroupDisabled: boolean

rqbContext

rqbContext: object

rqbContext.controlClassnames

rqbContext.controlClassnames: Partial<Classnames> & Classnames

This can be used to assign specific CSS classes to various controls that are rendered by QueryBuilder.

rqbContext.controlElements

rqbContext.controlElements: Partial<object> & Required<SetNonNullable<Partial<object>, "ruleGroup" | "rule" | "shiftActions" | "actionElement" | "addGroupAction" | "addRuleAction" | "cloneGroupAction" | "cloneRuleAction" | "combinatorSelector" | "dragHandle" | "fieldSelector" | "inlineCombinator" | "lockGroupAction" | "lockRuleAction" | "notToggle" | "operatorSelector" | "removeGroupAction" | "removeRuleAction" | "ruleGroupBodyElements" | "ruleGroupHeaderElements" | "valueEditor" | "valueSelector" | "valueSourceSelector">>

Defines replacement components.

rqbContext.debugMode

rqbContext.debugMode: boolean

Enables debug logging for QueryBuilder (and React DnD when applicable).

Default

false

rqbContext.enableDragAndDrop

rqbContext.enableDragAndDrop: boolean

Enables drag-and-drop features.

Default

false

rqbContext.enableMountQueryChange

rqbContext.enableMountQueryChange: boolean

Set to false to avoid calling the onQueryChange callback when the component mounts.

Default

true

rqbContext.initialQuery

rqbContext.initialQuery: RuleGroupType<GetRuleTypeFromGroupWithFieldAndOperator<RG, F, O>, string> | RuleGroupTypeIC<GetRuleTypeFromGroupWithFieldAndOperator<RG, F, O>, string>

rqbContext.qbId?

optional rqbContext.qbId: string

rqbContext.translations

rqbContext.translations: Partial<Translations> & TranslationsFull

This can be used to override translatable texts applied to the various controls that are rendered by QueryBuilder.

schema

schema: Schema<F, GetOptionIdentifierType<O>>

translations

translations: Partial<Translations> & TranslationsFull

wrapperClassName

wrapperClassName: string

Defined in

packages/react-querybuilder/src/hooks/useQueryBuilderSchema.ts:61


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.