- Prop
value- Type
string | undefined- Default
- —
- Requirement
- optional
Docs Components Uncategorized
AsyncValidatedInput
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { AsyncValidatedInput } from "@grassroot/ui-react";const asyncValidatedInputFixture = { id: "async-validated-input", ariaLabel: "Workspace slug", placeholder: "workspace-slug", submitLabel: "Validate", validValue: "grassroot", defaultValue: "grassroot",} satisfies { id: string; ariaLabel: string; placeholder: string; submitLabel: string; validValue: string; defaultValue: string;}; export default function AsyncValidatedInputDemo() { return ( <AsyncValidatedInput defaultValue={f.defaultValue} ariaLabel={f.ariaLabel} placeholder={f.placeholder} submitLabel={f.submitLabel} validate={async (value) => { if (value !== f.validValue) throw new Error("Invalid"); }} /> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { AsyncValidatedInput } from "@grassroot/ui-vue";const asyncValidatedInputFixture = { id: "async-validated-input", ariaLabel: "Workspace slug", placeholder: "workspace-slug", submitLabel: "Validate", validValue: "grassroot", defaultValue: "grassroot",} satisfies { id: string; ariaLabel: string; placeholder: string; submitLabel: string; validValue: string; defaultValue: string;}; async function validate(value: string) { if (value !== f.validValue) throw new Error("Invalid");}</script> <template> <AsyncValidatedInput :default-value="f.defaultValue" :aria-label="f.ariaLabel" :placeholder="f.placeholder" :submit-label="f.submitLabel" :validate="validate" /></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";const asyncValidatedInputFixture = { id: "async-validated-input", ariaLabel: "Workspace slug", placeholder: "workspace-slug", submitLabel: "Validate", validValue: "grassroot", defaultValue: "grassroot",} satisfies { id: string; ariaLabel: string; placeholder: string; submitLabel: string; validValue: string; defaultValue: string;}; import { GrassrootAsyncValidatedInput } from "@grassroot/ui-angular"; @Component({ selector: "app-async-validated-input-demo", standalone: true, imports: [GrassrootAsyncValidatedInput], host: { style: "display: contents" }, template: ` <grassroot-async-validated-input [validate]="validate" [defaultValue]="fixture.defaultValue" [ariaLabel]="fixture.ariaLabel" [placeholder]="fixture.placeholder" [submitLabel]="fixture.submitLabel" /> `,})export class AsyncValidatedInputDemoComponent { protected readonly fixture = f; protected readonly validate = async (value: string): Promise<void> => { if (value !== f.validValue) throw new Error("Invalid"); };} export default AsyncValidatedInputDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { AsyncValidatedInput } from "@grassroot/ui-svelte"; const asyncValidatedInputFixture = { id: "async-validated-input", ariaLabel: "Workspace slug", placeholder: "workspace-slug", submitLabel: "Validate", validValue: "grassroot", defaultValue: "grassroot", } satisfies { id: string; ariaLabel: string; placeholder: string; submitLabel: string; validValue: string; defaultValue: string; }; async function validate(value: string) { if (value !== f.validValue) throw new Error("Invalid"); }</script> <AsyncValidatedInput defaultValue={f.defaultValue} ariaLabel={f.ariaLabel} placeholder={f.placeholder} submitLabel={f.submitLabel} {validate}/>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { AsyncValidatedInput } from "@grassroot/ui-solid";const asyncValidatedInputFixture = { id: "async-validated-input", ariaLabel: "Workspace slug", placeholder: "workspace-slug", submitLabel: "Validate", validValue: "grassroot", defaultValue: "grassroot",} satisfies { id: string; ariaLabel: string; placeholder: string; submitLabel: string; validValue: string; defaultValue: string;}; export default function AsyncValidatedInputDemo() { return ( <AsyncValidatedInput defaultValue={f.defaultValue} ariaLabel={f.ariaLabel} placeholder={f.placeholder} submitLabel={f.submitLabel} validate={async (value) => { if (value !== f.validValue) throw new Error("Invalid"); }} /> );}Installation
API Reference
Import
import { AsyncValidatedInput } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
valuestring | undefined—
optional
defaultValuestring | undefined—
optional
validate(value: string) => void | Promise<void>—
required
onValueChange((value: string) => void) | undefined—
optional
statusAsyncValidatedInputStatus | undefined—
optional
pendingboolean | undefined—
optional
messagestring | undefined—
optional
ariaLabelstring | undefined—
optional
placeholderstring | undefined—
optional
- Prop
defaultValue- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
validate- Type
(value: string) => void | Promise<void>- Default
- —
- Requirement
- required
- Prop
onValueChange- Type
((value: string) => void) | undefined- Default
- —
- Requirement
- optional
- Prop
status- Type
AsyncValidatedInputStatus | undefined- Default
- —
- Requirement
- optional
- Prop
pending- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
message- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
placeholder- Type
string | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | ((value: string) => void) | undefined |
Content regions
childrensubmitLabel
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { AsyncValidatedInput } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
valuestring | undefined—
optional
defaultValuestring | undefined—
optional
validate(value: string) => void | Promise<void>—
required
onValueChange((value: string) => void) | undefined—
optional
statusAsyncValidatedInputStatus | undefined"idle"optional
pendingboolean | undefinedfalseoptional
messagestring | undefined—
optional
ariaLabelstring | undefined"Value"optional
placeholderstring | undefined"Enter a value"optional
submitLabelstring | undefined"Validate"optional
classNamestring | undefined—
optional
- Prop
value- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
validate- Type
(value: string) => void | Promise<void>- Default
- —
- Requirement
- required
- Prop
onValueChange- Type
((value: string) => void) | undefined- Default
- —
- Requirement
- optional
- Prop
status- Type
AsyncValidatedInputStatus | undefined- Default
"idle"- Requirement
- optional
- Prop
pending- Type
boolean | undefined- Default
false- Requirement
- optional
- Prop
message- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
"Value"- Requirement
- optional
- Prop
placeholder- Type
string | undefined- Default
"Enter a value"- Requirement
- optional
- Prop
submitLabel- Type
string | undefined- Default
"Validate"- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Import
import { Component } from "@angular/core";
import { GrassrootAsyncValidatedInput } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
validate(value: string) => void | Promise<void>—
required
statusAsyncValidatedInputStatus"idle"optional
pendingbooleanfalseoptional
messagestring—
optional
ariaLabelstring"Value"optional
placeholderstring"Enter a value"optional
submitLabelstring"Validate"optional
classNamestring—
optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
validate- Type
(value: string) => void | Promise<void>- Default
- —
- Requirement
- required
- Prop
status- Type
AsyncValidatedInputStatus- Default
"idle"- Requirement
- optional
- Prop
pending- Type
boolean- Default
false- Requirement
- optional
- Prop
message- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
"Value"- Requirement
- optional
- Prop
placeholder- Type
string- Default
"Enter a value"- Requirement
- optional
- Prop
submitLabel- Type
string- Default
"Validate"- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
valueChange | string |
Import
import { AsyncValidatedInput } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
validate(value: string) => void | Promise<void>—
required
onValueChange(value: string) => void—
optional
statusAsyncValidatedInputStatus"idle"optional
pendingbooleanfalseoptional
messagestring—
optional
ariaLabelstring"Value"optional
placeholderstring"Enter a value"optional
submitLabelstring"Validate"optional
classNamestring—
optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
validate- Type
(value: string) => void | Promise<void>- Default
- —
- Requirement
- required
- Prop
onValueChange- Type
(value: string) => void- Default
- —
- Requirement
- optional
- Prop
status- Type
AsyncValidatedInputStatus- Default
"idle"- Requirement
- optional
- Prop
pending- Type
boolean- Default
false- Requirement
- optional
- Prop
message- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
"Value"- Requirement
- optional
- Prop
placeholder- Type
string- Default
"Enter a value"- Requirement
- optional
- Prop
submitLabel- Type
string- Default
"Validate"- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (value: string) => void |
Content regions
children
Import
import { AsyncValidatedInput } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
validate(value: string) => void | Promise<void>—
required
onValueChange(value: string) => void—
optional
statusAsyncValidatedInputStatus—
optional
pendingboolean—
optional
messagestring—
optional
ariaLabelstring—
optional
placeholderstring—
optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
validate- Type
(value: string) => void | Promise<void>- Default
- —
- Requirement
- required
- Prop
onValueChange- Type
(value: string) => void- Default
- —
- Requirement
- optional
- Prop
status- Type
AsyncValidatedInputStatus- Default
- —
- Requirement
- optional
- Prop
pending- Type
boolean- Default
- —
- Requirement
- optional
- Prop
message- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
placeholder- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (value: string) => void |
Content regions
childrensubmitLabel
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.