+++
# -----------------------------------------------------------------------
# Do not edit this file. It is automatically generated by API Documenter.
# -----------------------------------------------------------------------
title = "QueryField"
keywords = ["grafana","documentation","sdk","@grafana/ui"]
type = "docs"
+++
## QueryField class
Renders an editor field. Pass initial value as initialQuery and listen to changes in props.onValueChanged. This component can only process strings. Internally it uses Slate Value. Implement props.onTypeahead to use suggestions, see PromQueryField.tsx as an example.
Signature
```typescript
export declare class QueryField extends React.PureComponent
```
Import
```typescript
import { QueryField } from '@grafana/ui';
```
Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [constructor(props, context)](#constructor-propscontext) | | Constructs a new instance of the QueryField
class |
Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [editor](#editor-property) | | Editor | null
| |
| [handleBlur](#handleblur-property) | | (event: Event, editor: CoreEditor, next: Function) => any
| We need to handle blur events here mainly because of dashboard panels which expect to have query executed on blur. |
| [lastExecutedValue](#lastexecutedvalue-property) | | Value | null
| |
| [mounted](#mounted-property) | | boolean
| |
| [onChange](#onchange-property) | | (value: Value, runQuery?: boolean | undefined) => void
| Update local state, propagate change upstream and optionally run the query afterwards. |
| [plugins](#plugins-property) | | Plugin[]
| |
| [runOnChange](#runonchange-property) | | () => void
| |
| [runOnChangeAndRunQuery](#runonchangeandrunquery-property) | | () => void
| |
| [runOnChangeDebounced](#runonchangedebounced-property) | | Function
| |
| [runOnRunQuery](#runonrunquery-property) | | () => void
| |
Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [componentDidMount()](#componentdidmount-method) | | |
| [componentDidUpdate(prevProps, prevState)](#componentdidupdate-method) | | |
| [componentWillUnmount()](#componentwillunmount-method) | | |
| [render()](#render-method) | | |
### constructor(props, context)
Constructs a new instance of the `QueryField` class
Signature
```typescript
constructor(props: QueryFieldProps, context: Context);
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| props | QueryFieldProps
| |
| context | Context<any>
| |
### editor property
Signature
```typescript
editor: Editor | null;
```
### handleBlur property
We need to handle blur events here mainly because of dashboard panels which expect to have query executed on blur.
Signature
```typescript
handleBlur: (event: Event, editor: CoreEditor, next: Function) => any;
```
### lastExecutedValue property
Signature
```typescript
lastExecutedValue: Value | null;
```
### mounted property
Signature
```typescript
mounted: boolean;
```
### onChange property
Update local state, propagate change upstream and optionally run the query afterwards.
Signature
```typescript
onChange: (value: Value, runQuery?: boolean | undefined) => void;
```
### plugins property
Signature
```typescript
plugins: Plugin[];
```
### runOnChange property
Signature
```typescript
runOnChange: () => void;
```
### runOnChangeAndRunQuery property
Signature
```typescript
runOnChangeAndRunQuery: () => void;
```
### runOnChangeDebounced property
Signature
```typescript
runOnChangeDebounced: Function;
```
### runOnRunQuery property
Signature
```typescript
runOnRunQuery: () => void;
```
### componentDidMount method
Signature
```typescript
componentDidMount(): void;
```
Returns:
`void`
### componentDidUpdate method
Signature
```typescript
componentDidUpdate(prevProps: QueryFieldProps, prevState: QueryFieldState): void;
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| prevProps | QueryFieldProps
| |
| prevState | QueryFieldState
| |
Returns:
`void`
### componentWillUnmount method
Signature
```typescript
componentWillUnmount(): void;
```
Returns:
`void`
### render method
Signature
```typescript
render(): JSX.Element;
```
Returns:
`JSX.Element`