ui-ingredients
Version:
Headless component library for Svelte powered by zag
35 lines (34 loc) • 1.12 kB
TypeScript
import type { HTMLAttributes, HTMLInputAttributes, HTMLLabelAttributes, HTMLSelectAttributes, HTMLTextareaAttributes } from 'svelte/elements';
interface ElementIds {
root?: string;
label?: string;
control?: string;
errorText?: string;
helperText?: string;
}
export interface CreateFieldProps {
id?: string;
ids?: ElementIds;
invalid?: boolean;
required?: boolean;
disabled?: boolean;
readOnly?: boolean;
}
export interface CreateFieldReturn {
ids: ElementIds;
disabled: boolean;
required: boolean;
readOnly: boolean;
invalid: boolean;
'aria-describedby': string;
getRootProps(): HTMLAttributes<HTMLElement>;
getLabelProps(): HTMLLabelAttributes;
getErrorTextProps(): HTMLAttributes<HTMLElement>;
getHelperTextProps(): HTMLAttributes<HTMLElement>;
getInputProps(): HTMLInputAttributes;
getSelectProps(): HTMLSelectAttributes;
getTextareaProps(): HTMLTextareaAttributes;
getRequiredIndicatorProps(): HTMLAttributes<HTMLElement>;
}
export declare function createField(props: CreateFieldProps): CreateFieldReturn;
export {};