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

8.0.0 • Public • Published

@react-querybuilder/tremor

Official react-querybuilder compatibility package for Tremor.

Screenshot

Installation

npm i react-querybuilder @react-querybuilder/tremor @tremor/react
# OR yarn add / pnpm add / bun add

Usage

To configure the query builder to use Tremor-compatible components, place QueryBuilderTremor above QueryBuilder in the component hierarchy.

import { useState } from 'react';
import { QueryBuilderTremor } from '@react-querybuilder/tremor';
import { type Field, QueryBuilder, type RuleGroupType } from 'react-querybuilder';

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

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

  return (
    <QueryBuilderTremor>
      <QueryBuilder fields={fields} defaultQuery={query} onQueryChange={setQuery} />
    </QueryBuilderTremor>
  );
}

QueryBuilderTremor is a React context provider that assigns the following props to all descendant QueryBuilder elements. The props can be overridden on the QueryBuilder or used directly without the context provider.

Export QueryBuilder prop
tremorControlElements controlElements
tremorControlClassnames controlClassnames
TremorActionElement controlElements.actionElement
TremorNotToggle controlElements.notToggle
TremorShiftActions controlElements.shiftActions
TremorValueEditor controlElements.valueEditor
TremorValueSelector controlElements.valueSelector

Package Sidebar

Install

npm i @react-querybuilder/tremor

Weekly Downloads

56

Version

8.0.0

License

MIT

Unpacked Size

340 kB

Total Files

28

Last publish

Collaborators

  • jakeboone02