Nevertheless! Party Metaphorically

    @react-querybuilder/chakra
    TypeScript icon, indicating that this package has built-in type declarations

    4.5.1 • Public • Published

    @react-querybuilder/chakra

    Official react-querybuilder components for Chakra UI.

    To see them in action, check out the react-querybuilder demo or load the example in CodeSandbox.

    Installation

    npm i --save react-querybuilder @react-querybuilder/chakra @chakra-ui/icons @chakra-ui/react @chakra-ui/system @emotion/react @emotion/styled framer-motion
    # OR
    yarn add react-querybuilder @react-querybuilder/chakra @chakra-ui/icons @chakra-ui/react @chakra-ui/system @emotion/react @emotion/styled framer-motion

    Usage

    import { ChakraProvider, extendTheme } from '@chakra-ui/react';
    import { chakraControlElements } from '@react-querybuilder/chakra';
    import { QueryBuilder, RuleGroupType } from 'react-querybuilder';
    
    const fields = [
      { name: 'firstName', label: 'First Name' },
      { name: 'lastName', label: 'Last Name' },
    ];
    
    const App = () => {
      const [query, setQuery] = useState<RuleGroupType>({ combinator: 'and', rules: [] });
      const chakraTheme = extendTheme();
    
      return (
        <ChakraProvider theme={chakraTheme}>
          <QueryBuilder
            fields={fields}
            query={query}
            onQueryChange={q => setQuery(q)}
            controlElements={chakraControlElements}
          />
        </ChakraProvider>
      );
    };

    Some additional styling may be necessary, e.g.:

    .queryBuilder .chakra-select__wrapper {
      width: fit-content;
      display: inline-block;
    }
    
    .queryBuilder .chakra-input {
      width: auto;
      display: inline-block;
    }
    
    .queryBuilder .chakra-radio-group {
      display: inline-block;
    }

    Keywords

    none

    Install

    npm i @react-querybuilder/chakra

    DownloadsWeekly Downloads

    79

    Version

    4.5.1

    License

    MIT

    Unpacked Size

    52.7 kB

    Total Files

    15

    Last publish

    Collaborators

    • jakeboone02