RuleGroup
The RuleGroup component renders the recursive, hierarchical query structure of React Query Builder. It calls the useRuleGroup hook to prepare props for its subcomponents.
Subcomponents
RuleGroup renders an outer <div> containing two inner <div>s: the first with header elements (based on group properties) and the second with body elements (derived primarily from the group's rules array).
The header and body layout components are HTML-agnostic. This allows @react-querybuilder/native to render the same layout components within React Native <View> elements, and you can adapt them similarly for other frameworks.
RuleGroupHeaderComponents
This component renders the following elements in this order:
- Shift actions1
- Drag handle2
- Combinator selector3
- "Not" toggle4
- Add rule button
- Add group button
- Clone group button5
- Lock group button6
- Remove group button7
RuleGroupBodyComponents
This component iterates through a group's rules array, rendering a child RuleGroup element for each subgroup and a Rule element for each rule.
When showCombinatorsBetweenRules is true, an inline combinator8 (using the group's combinator value) appears before each rule or group except the first.
With independent combinators, each odd-numbered index in the rules array contains a string representing a combinator value. These elements render as independent inline combinators.
The showCombinatorsBetweenRules prop is ignored if the query is using independent combinators.