Skip to content

Commit 53b583b

Browse files
Vojtěch Václav Portešvojtechportes
authored andcommitted
docs: Updated README structure and unified link titles to use same terminology in link title prefixes
1 parent cfcfecf commit 53b583b

1 file changed

Lines changed: 61 additions & 61 deletions

File tree

README.md

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,62 @@ npm install @vojtechportes/react-query-builder
4444

4545
React Query Builder supports React `18+`.
4646

47+
## Example
48+
49+
```tsx
50+
import React, { useState } from 'react';
51+
import {
52+
Builder,
53+
type DenormalizedQuery,
54+
type IBuilderFieldProps,
55+
} from '@vojtechportes/react-query-builder';
56+
57+
const fields: IBuilderFieldProps[] = [
58+
{
59+
field: 'STATE',
60+
label: 'State',
61+
type: 'LIST',
62+
operators: ['EQUAL', 'NOT_EQUAL'],
63+
value: [
64+
{ value: 'CZ', label: 'Czech Republic' },
65+
{ value: 'SK', label: 'Slovakia' },
66+
],
67+
},
68+
{
69+
field: 'IS_IN_EU',
70+
label: 'Is in EU',
71+
type: 'BOOLEAN',
72+
},
73+
];
74+
75+
const initialData: DenormalizedQuery = [
76+
{
77+
type: 'GROUP',
78+
value: 'AND',
79+
isNegated: false,
80+
children: [
81+
{
82+
field: 'STATE',
83+
operator: 'EQUAL',
84+
value: 'CZ',
85+
readOnly: true,
86+
},
87+
{
88+
field: 'IS_IN_EU',
89+
operator: 'EQUAL',
90+
value: true,
91+
},
92+
],
93+
},
94+
];
95+
96+
export const MyBuilder = () => {
97+
const [data, setData] = useState(initialData);
98+
99+
return <Builder fields={fields} data={data} onChange={setData} />;
100+
};
101+
```
102+
47103
## UI Adapters
48104

49105
The package also exposes ready-made component mappings through versioned
@@ -136,62 +192,6 @@ More adapter details:
136192
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/adapters" target="_blank" rel="noopener noreferrer">Documentation: Adapters</a>
137193
- <a href="https://vojtechportes.github.io/react-query-builder/api/adapters" target="_blank" rel="noopener noreferrer">API: Adapters</a>
138194

139-
## Example
140-
141-
```tsx
142-
import React, { useState } from 'react';
143-
import {
144-
Builder,
145-
type DenormalizedQuery,
146-
type IBuilderFieldProps,
147-
} from '@vojtechportes/react-query-builder';
148-
149-
const fields: IBuilderFieldProps[] = [
150-
{
151-
field: 'STATE',
152-
label: 'State',
153-
type: 'LIST',
154-
operators: ['EQUAL', 'NOT_EQUAL'],
155-
value: [
156-
{ value: 'CZ', label: 'Czech Republic' },
157-
{ value: 'SK', label: 'Slovakia' },
158-
],
159-
},
160-
{
161-
field: 'IS_IN_EU',
162-
label: 'Is in EU',
163-
type: 'BOOLEAN',
164-
},
165-
];
166-
167-
const initialData: DenormalizedQuery = [
168-
{
169-
type: 'GROUP',
170-
value: 'AND',
171-
isNegated: false,
172-
children: [
173-
{
174-
field: 'STATE',
175-
operator: 'EQUAL',
176-
value: 'CZ',
177-
readOnly: true,
178-
},
179-
{
180-
field: 'IS_IN_EU',
181-
operator: 'EQUAL',
182-
value: true,
183-
},
184-
],
185-
},
186-
];
187-
188-
export const MyBuilder = () => {
189-
const [data, setData] = useState(initialData);
190-
191-
return <Builder fields={fields} data={data} onChange={setData} />;
192-
};
193-
```
194-
195195
## Text Mode
196196

197197
`Builder` can optionally switch between the visual query UI and a SQL text
@@ -246,10 +246,10 @@ The library also provides parser and formatter helpers through subpath exports:
246246

247247
Supported formats are documented on the website:
248248

249-
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/parsing-and-formatting" target="_blank" rel="noopener noreferrer">Parsing and Formatting</a>
250-
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/parsing-and-formatting/supported-formats" target="_blank" rel="noopener noreferrer">Supported Formats</a>
251-
- <a href="https://vojtechportes.github.io/react-query-builder/api/format-query" target="_blank" rel="noopener noreferrer">formatQuery API</a>
252-
- <a href="https://vojtechportes.github.io/react-query-builder/api/parse-query" target="_blank" rel="noopener noreferrer">parseQuery API</a>
249+
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/parsing-and-formatting" target="_blank" rel="noopener noreferrer">Documentation: Parsing and Formatting</a>
250+
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/parsing-and-formatting/supported-formats" target="_blank" rel="noopener noreferrer">Documentation: Supported Formats</a>
251+
- <a href="https://vojtechportes.github.io/react-query-builder/api/format-query" target="_blank" rel="noopener noreferrer">API: formatQuery</a>
252+
- <a href="https://vojtechportes.github.io/react-query-builder/api/parse-query" target="_blank" rel="noopener noreferrer">API: parseQuery</a>
253253

254254
## Responsive Behavior
255255

@@ -262,5 +262,5 @@ The default builder components include a compact responsive layout for medium-wi
262262

263263
Responsive behavior is documented in more detail on the website:
264264

265-
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/components" target="_blank" rel="noopener noreferrer">Components</a>
265+
- <a href="https://vojtechportes.github.io/react-query-builder/documentation/components" target="_blank" rel="noopener noreferrer">Documentation: Components</a>
266266
- <a href="https://vojtechportes.github.io/react-query-builder/api/components" target="_blank" rel="noopener noreferrer">API: Components</a>

0 commit comments

Comments
 (0)