@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
47 lines • 1.93 kB
text/typescript
import type { AddressInputElement } from "./AddressInput.mjs";
import type { AssetSelectorElement } from "./AssetSelector.mjs";
import type { CheckboxElement } from "./Checkbox.mjs";
import type { DropdownElement } from "./Dropdown.mjs";
import type { FileInputElement } from "./FileInput.mjs";
import type { InputElement } from "./Input.mjs";
import type { RadioGroupElement } from "./RadioGroup.mjs";
import type { SelectorElement } from "./Selector.mjs";
import type { GenericSnapChildren } from "../../component.mjs";
/**
* The props of the {@link Field} component.
*
* @property label - The label of the field.
* @property error - The error message of the field.
* @property children - The input field and the submit button.
*/
export type FieldProps = {
label?: string | undefined;
error?: string | undefined;
children: [InputElement, GenericSnapChildren] | [GenericSnapChildren, InputElement] | [GenericSnapChildren, InputElement, GenericSnapChildren] | DropdownElement | RadioGroupElement | FileInputElement | InputElement | CheckboxElement | SelectorElement | AssetSelectorElement | AddressInputElement;
};
/**
* A field component, which is used to create a form field.
*
* @param props - The props of the component.
* @param props.label - The label of the field.
* @param props.error - The error message of the field.
* @param props.children - The input field and the submit button.
* @returns A field element.
* @example
* <Field label="Username">
* <Input name="username" type="text" />
* <Button type="submit">Submit</Button>
* </Field>
* @example
* <Field label="Upload file">
* <FileInput name="file" accept={['image/*']} multiple />
* </Field>
*/
export declare const Field: import("../../component.mjs").SnapComponent<FieldProps, "Field">;
/**
* A field element.
*
* @see Field
*/
export type FieldElement = ReturnType<typeof Field>;
//# sourceMappingURL=Field.d.mts.map