Skip to main content

useRule()

useRule(props): object

Prepares all values and methods used by the Rule component.

Parameters

ParameterType
propsRuleProps<string, string>

Returns

object

actions

actions: QueryActions

classNames

classNames: object

classNames.cloneRule

classNames.cloneRule: string

classNames.dragHandle

classNames.dragHandle: string

classNames.fields

classNames.fields: string

classNames.lockRule

classNames.lockRule: string

classNames.operators

classNames.operators: string

classNames.removeRule

classNames.removeRule: string

classNames.shiftActions

classNames.shiftActions: string

classNames.value

classNames.value: string

classNames.valueSource

classNames.valueSource: string

cloneRule()

cloneRule: (_event?, _context?) => void

Parameters

ParameterType
_event?any
_context?any

Returns

void

context?

optional context: any

disabled

disabled: boolean

dndRef

dndRef: Ref<HTMLDivElement>

dragMonitorId

dragMonitorId: string | symbol

dragRef

dragRef: Ref<HTMLSpanElement>

dropEffect?

optional dropEffect: DropEffect

"move" by default; "copy" if the modifier key is pressed.

dropMonitorId

dropMonitorId: string | symbol

field?

optional field: string

Deprecated

Use the field property of the rule prop instead

fieldData

fieldData: FullField<string, string, string, Option<string>, Option<string>>

generateOnChangeHandler()

generateOnChangeHandler: (prop) => (value, _context?) => void

Parameters

ParameterType
prop"value" | "disabled" | "field" | "operator" | "valueSource" | "combinatorPreceding"

Returns

Function

Parameters
ParameterType
valueany
_context?any
Returns

void

hideValueControls

hideValueControls: boolean

id?

optional id: string

inputType

inputType: null | InputType

isDragging?

optional isDragging: boolean

isOver?

optional isOver: boolean

operator?

optional operator: string

Deprecated

Use the operator property of the rule prop instead

operators

operators: FullOperator<string>[] | OptionGroup<FullOperator<string>>[]

outerClassName

outerClassName: string

parentDisabled?

optional parentDisabled: boolean

path

path: Path

removeRule()

removeRule: (_event?, _context?) => void

Parameters

ParameterType
_event?any
_context?any

Returns

void

rule

rule: RuleType<string, string, any, string>

schema

schema: Schema<FullOption<string>, string>

shiftDownDisabled?

optional shiftDownDisabled: boolean

shiftRuleDown()

shiftRuleDown: (event?, _context?) => void

Parameters

ParameterType
event?MouseEvent<Element, MouseEvent>
_context?any

Returns

void

shiftRuleUp()

shiftRuleUp: (event?, _context?) => void

Parameters

ParameterType
event?MouseEvent<Element, MouseEvent>
_context?any

Returns

void

shiftUpDisabled?

optional shiftUpDisabled: boolean

toggleLockRule()

toggleLockRule: (_event?, _context?) => void

Parameters

ParameterType
_event?any
_context?any

Returns

void

translations

translations: Translations

validationResult

validationResult: boolean | ValidationResult

value?

optional value: any

Deprecated

Use the value property of the rule prop instead

valueEditorSeparator

valueEditorSeparator: ReactNode

valueEditorType

valueEditorType: ValueEditorType

valueSource?

optional valueSource: ValueSource

Deprecated

Use the valueSource property of the rule prop instead

valueSourceOptions

valueSourceOptions: object[]

valueSources

valueSources: ValueSources

values

values: FlexibleOptionList<Option<string>>

Defined in

packages/react-querybuilder/src/hooks/useRule.ts:17


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.