Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rijvi-mahmud/shaddy/llms.txt
Use this file to discover all available pages before exploring further.
UniqueTextField builds on a standard text input by adding real-time async availability checking. As the user types, the field debounces input and calls your checkFunction to verify uniqueness — for example, querying an API to confirm a username or email is not already taken. The input border turns green when the value is available and red when it is not, and a spinner is shown while checking is in progress.
Installation
Install all ShaddyForm fields at once with theshaddy-form registry item:
Usage
Props
The field name. Must match a key in your Zod schema passed to
ShaddyForm.An async function that receives the current debounced field value and returns
true if the value is available/unique or false if it is already taken. The field watches its own value via useFormContext and calls this function automatically.Label text rendered above the input. Omit to hide the label.
The HTML input type. Use
'email' for email uniqueness checks.Placeholder text shown inside the input when it is empty.
When
true, appends a red asterisk to the label as a visual indicator.Milliseconds to wait after the user stops typing before calling
checkFunction. Increase this value to reduce API request frequency.Additional Tailwind / CSS classes applied to the outermost
FormItem wrapper.Notes
- While
checkFunctionis running, aLoader2spinner appears on the right side of the input. - When the check resolves
true, the input border turns green and a checkmark icon is shown. - When the check resolves
false, the input border turns red (no icon is shown for “taken”). - If
checkFunctionthrows, the field silently resets to a neutral state — handle display of API errors through your Zod schema or a separate error state. UniqueTextFieldmust be used inside a<ShaddyForm>because it readscontrolandwatchfromuseFormContext.