Skip to content

custom combinator component, like toggle or radio instead of dropdown, can we have this feature? #617

Answered by jakeboone02
kuljeet2604 asked this question in Q&A
Discussion options

You must be logged in to vote

Use the controlElements prop (documentation), specifically the combinatorSelector property (documentation).

Example with radio buttons:

import { useId } from 'react';
import { QueryBuilder, ValueSelectorProps } from 'react-querybuilder';

const MyCombinatorSelector = (props: ValueSelectorProps) => {
  const name = useId();
  return (
    <>
      <label>
        <input
          type="radio"
          name={`combinator-${name}`}
          checked={props.value === 'and'}
          onClick={e => props.handleOnChange('and')}
        />
        {'AND'}
      </label>
      <label>
        <input
          type="radio"
          name={`combinator-${name}`}
          checked={props.value === 'or'}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jakeboone02
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #616 on December 21, 2023 14:57.