Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-querybuilder/chakra

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-querybuilder/chakra

Custom Chakra UI components for react-querybuilder

  • 4.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3K
increased by17.98%
Maintainers
1
Weekly downloads
 
Created
Source

@react-querybuilder/chakra

Official Chakra UI components for react-querybuilder.

To see them in action, check out the react-querybuilder demo and choose "Chakra UI" from the Style drop-down.

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 QueryBuilder, { RuleGroupType } from 'react-querybuilder';
import {
  ChakraActionElement,
  ChakraDragHandle,
  ChakraNotToggle,
  ChakraValueEditor,
  ChakraValueSelector
} from '@react-querybuilder/chakra';

const fields = [
  { name: 'firstName', label: 'First Name' },
  { name: 'lastName', label: 'Last Name' }
];

const App = () => {
  const [query, setQuery] = useState<RuleGroupType>({ combinator: 'and', rules: [] });

  return (
    <QueryBuilder
      fields={fields}
      query={query}
      onQueryChange={(q) => setQuery(q)}
      controlElements={{
        addGroupAction: ChakraActionElement,
        addRuleAction: ChakraActionElement,
        cloneGroupAction: ChakraActionElement,
        cloneRuleAction: ChakraActionElement,
        combinatorSelector: ChakraValueSelector,
        fieldSelector: ChakraValueSelector,
        notToggle: ChakraNotToggle,
        operatorSelector: ChakraValueSelector,
        removeGroupAction: ChakraActionElement,
        removeRuleAction: ChakraActionElement,
        valueEditor: ChakraValueEditor,
        dragHandle: ChakraDragHandle
      }}
    />
  );
};

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

.chakra-select__wrapper {
  width: fit-content;
  width: -moz-fit-content; // vendor prefix required for Firefox
  display: inline-block;
}

.chakra-input {
  width: auto;
  display: inline-block;
}

.chakra-radio-group {
  display: inline-block;
}

FAQs

Package last updated on 18 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc