@react-querybuilder/bulma
Official react-querybuilder components for Bulma.
To see them in action, check out the react-querybuilder
demo and choose "Bulma" from the Style drop-down.
Installation
npm i --save react-querybuilder @react-querybuilder/bulma bulma react-bulma-components
yarn add react-querybuilder @react-querybuilder/bulma bulma react-bulma-components
Usage
import QueryBuilder, { RuleGroupType } from 'react-querybuilder';
import { bulmaControlElements } from '@react-querybuilder/bulma';
import 'bulma/bulma.sass';
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={bulmaControlElements}
/>
);
};
Some additional styling may be necessary, e.g.:
.input {
width: auto;
}