ui-ingredients
Version:
Headless component library for Svelte powered by zag
37 lines (36 loc) • 1.22 kB
TypeScript
import type { HTMLAttributes, HTMLInputAttributes, HTMLLabelAttributes, HTMLSelectAttributes, HTMLTextareaAttributes } from 'svelte/elements';
import type { Accessor } from '../types.js';
interface ElementIds {
root?: string;
label?: string;
control?: string;
errorText?: string;
helperText?: string;
requiredIndicator?: 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: Accessor<CreateFieldProps>): Accessor<CreateFieldReturn>;
export {};