@react-querybuilder/bulma
Official react-querybuilder components for Bulma.
To see them in action, check out the react-querybuilder
demo or load the example in CodeSandbox.
Full documentation
Installation
npm i --save react-querybuilder @react-querybuilder/bulma bulma
yarn add react-querybuilder @react-querybuilder/bulma bulma
Usage
To render Bulma-compatible components in the query builder, wrap the <QueryBuilder />
element in <QueryBuilderBulma />
.
import { QueryBuilderBulma } from '@react-querybuilder/bulma';
import 'bulma/bulma.sass';
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: [] });
return (
<QueryBuilderBulma>
<QueryBuilder fields={fields} query={query} onQueryChange={q => setQuery(q)} />
</QueryBuilderBulma>
);
};
Notes
-
Some additional styling may be necessary, e.g.:
.queryBuilder .input {
width: auto;
}
-
This package exports bulmaControlElements
which can be assigned directly to the controlElements
prop on <QueryBuilder />
(and also exports each component individually), but wrapping <QueryBuilder />
in <QueryBuilderBulma />
is the recommended method.