PromptBox ToolsPremium
The PromptBox provides several built-in tools that enhance functionality and user experience.
These tools include the Action button for submitting prompts, the Upload button for attaching files, and the Speech-to-Text button for voice input. If you need additional tools, refer to the PromptBox Adornments article.
Action Button
The Action button submits the prompt. Customize its appearance and behavior by setting the actionButtonConfig property to an PromptBoxActionButton object.
The button supports a loading state for better user feedback during prompt submission and icon customizations for each state.
The following example demonstrates how to configure the Action Button in the PromptBox.
Speech-to-Text Button
The Speech-to-Text button enables you to input prompts with voice commands. Customize its appearance and behavior by setting the speechToTextButtonConfig property to true or PromptBoxSpeechToTextButton object. The button provides visual feedback during the speech recognition process.
The following example demonstrates how to configure the Speech-to-Text Button in the PromptBox.
Upload Button
The Upload button allows you to attach files to prompts. You can customize its appearance, behavior, and file restrictions by setting the uploadButtonConfig property to a PromptBoxUploadButton object.
To enable file attachments in the PromptBox, set the uploadButtonConfig property to true or use PromptBoxUploadButton for further customization.
Attaching Multiple Files
To allow users to attach multiple files, set the multiple property of the PromptBoxUploadButton to true.
<PromptBox uploadButtonConfig={{ multiple: true }} />
File Size Restrictions
To restrict the minimum and maximum file size for attachments, set the restrictions property of the PromptBoxUploadButton to an object containing the minFileSize and maxFileSize properties.
<PromptBox uploadButtonConfig={{ restrictions: { minFileSize: 1024, maxFileSize: 1048576 } }} />
File Type Restrictions
To restrict the allowed file types for attachments, set the restrictions property of the PromptBoxUploadButton to an object containing the allowedExtensions property.
Additionally, set the accept property to enable the allowed file types in the file selection dialog.
This property accepts an array of strings representing the allowed file types or extensions.
<PromptBox
uploadButtonConfig={{
accept: '.png,.jpg,.jpeg',
restrictions: { allowedExtensions: ['.png', '.jpg', '.jpeg'] }
}}
/>