welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
38 lines (37 loc) • 1.16 kB
TypeScript
import { HTMLAttributes } from 'react';
import { HintProps } from '../Hint/types';
import { LabelProps } from '../Label/types';
export interface FieldOptions extends VariantProps {
children: React.ReactNode;
disabled?: boolean;
disabledIcon?: React.ReactNode;
hideLabel?: boolean;
hint?: React.ReactNode;
hintProps?: HintProps;
/**
* If true, the field will be displayed inline (horizontally) instead of block (vertically).
*/
inline?: boolean;
label: React.ReactNode;
labelProps?: LabelProps;
required?: boolean;
}
export type FieldState = {
disabled?: boolean;
/**
* Function that provides the necessary accessibility props to the input element.
*/
getInputProps: FieldGetInputPropsFunction;
hintID: string;
labelID: string;
required?: boolean;
variant?: FieldStateVariant;
};
export type FieldStateVariant = 'danger' | 'success' | 'warning';
type FieldGetInputPropsFunction = <T extends HTMLAttributes<HTMLElement>>(ownProps?: T) => T;
type VariantProps = {
error?: React.ReactNode;
success?: React.ReactNode;
warning?: React.ReactNode;
};
export {};