GridSmartBoxAIAssistantProps
Represents the props for the SmartBox component. SmartBox provides a unified search interface with three modes: standard search, semantic search, and AI assistant for natural language grid operations.
The AI assistant supports three operational modes configured via aiAssistantConfig:
- Auto mode: Set
requestOptions(withurl) - SmartBox handles requests automatically - Controlled mode: Set
requestUrl- SmartBox makes requests, you control loading state - Manual mode: Don't set
requestUrlorrequestOptions- Handle requests viaonAIPromptRequest
// Auto mode - SmartBox handles everything automatically
<SmartBox
aiAssistantConfig={{
enabled: true,
requestOptions: {
url: '/api/ai/grid',
timeout: 5000
},
promptSuggestions: ['Sort by price', 'Filter active items']
}}
searchConfig={{ enabled: true }}
/>
// Controlled mode - SmartBox makes requests, you control loading state
<SmartBox
loading={isLoading}
aiAssistantConfig={{
enabled: true,
requestUrl: '/api/ai/grid'
}}
onAIPromptRequest={(e) => setIsLoading(true)}
onAIResponseSuccess={(e) => setIsLoading(false)}
/>
// Manual mode - fully custom request handling
<SmartBox
loading={isLoading}
aiAssistantConfig={{ enabled: true }}
onAIPromptRequest={(e) => {
setIsLoading(true);
myCustomFetch(e.requestData).then(handleResponse);
}}
/>
| Name | Type | Default | Description |
|---|---|---|---|
activeMode? |
|
Sets the currently active mode. tsx
| |
aiAssistantConfig? |
|
Configures the AI assistant mode settings. Can be a boolean to enable/disable or an object with detailed settings. tsx
| |
dir? |
|
|
Sets the text direction. |
enabled? |
|
Specifies whether the mode is enabled. | |
history? |
|
Sets the settings for the history queries of all modes.
When set to tsx
| |
historyItemRender? |
|
Custom render function for history items. tsx
| |
loading? |
|
Sets whether the SmartBox is in loading state. Use this for controlled mode to manage loading state externally. tsx
| |
onAICancelRequest? |
|
Fires when an AI request is cancelled by the user. The user can cancel by clicking the stop button during loading. tsx
| |
onAIPromptRequest? |
|
Fires when an AI prompt request is initiated. Use this callback to intercept requests, modify data, or handle requests manually. tsx
| |
onAIResponseError? |
|
Fires when an AI response returns an error.
Only fires in auto or controlled mode when a tsx
| |
onAIResponseSuccess? |
|
Fires when an AI response is received successfully.
Only fires in auto or controlled mode when a tsx
| |
onBlur? |
|
Fires when the SmartBox input is blurred. | |
onClose? |
|
Fires when the SmartBox popup closes. tsx
| |
onFocus? |
|
Fires when the SmartBox input is focused. | |
onOpen? |
|
Fires when the SmartBox popup opens. tsx
| |
onSearch? |
|
Fires when a search is performed in Search mode. The event contains the search value and filter descriptor. tsx
| |
onSemanticSearch? |
|
Fires when a search is performed in Semantic Search mode. The event contains the search value and filter descriptor. tsx
| |
placeholder? |
|
Sets the placeholder text for the SmartBox input. | |
promptSuggestionRender? |
|
Custom render function for prompt suggestions. tsx
| |
searchConfig? |
|
Configures the search mode settings. Can be a boolean to enable/disable or an object with detailed settings. tsx
| |
semanticSearchConfig? |
|
Configures the semantic search mode settings. Can be a boolean to enable/disable or an object with detailed settings. tsx
| |
size? |
|
|
Sets the size of the SmartBox. tsx
|
textboxProps? |
|
Props to pass to the TextBox component. |