@react-md/form
Version:
This package is for creating all the different form input types.
72 lines (71 loc) • 2.63 kB
TypeScript
import type { HTMLAttributes, ReactNode } from "react";
import type { FormThemeOptions } from "../FormThemeProvider";
export interface TextFieldContainerOptions extends FormThemeOptions {
/**
* Boolean if the form components should be using the `dense` spec to reduce
* the sizing slightly.
*/
dense?: boolean;
/**
* Boolean if the component should be rendered inline with
* `display: inline-flex` instead of `display: flex`.
*/
inline?: boolean;
/**
* Boolean if the component should gain `flex: 1 1 auto;` which is useful for
* full-width behavior within flex containers.
*
* @defaultValue `false`
* @remarks \@since 5.0.0
*/
stretch?: boolean;
/**
* Boolean if the text field should gain the error state and update the
* colors.
*/
error?: boolean;
/**
* An optional addon to apply to the left of the text field. This should
* normally be an icon. This element will not have pointer events so it can be
* "clicked through" to focus the text field instead.
*/
leftChildren?: ReactNode;
/**
* Boolean if the left children should be wrapped in the `TextFieldAddon`
* component. This is enabled by default since this is _normally_ the behavior
* that is desired so that icons can be positioned correctly.
*/
isLeftAddon?: boolean;
/**
* An optional addon to apply to the right of the text field. This should be a
* clickable button such as a password field toggle or a reset button for the
* field.
*/
rightChildren?: ReactNode;
/**
* Boolean if the right children should be wrapped in the `TextFieldAddon`
* component. This is enabled by default since this is _normally_ the behavior
* that is desired so that icons can be positioned correctly.
*/
isRightAddon?: boolean;
}
export interface TextFieldContainerProps extends TextFieldContainerOptions, HTMLAttributes<HTMLDivElement> {
/**
* Boolean if the text field is currently active (focused) to applied the
* active color to the current theme.
*/
active?: boolean;
/**
* Boolean if there is a floating label with the text field.
*/
label?: boolean;
/**
* Boolean if the text field is currently disabled.
*/
disabled?: boolean;
}
/**
* This is a container component that is used to structure the text field with
* different parts and themes.
*/
export declare const TextFieldContainer: import("react").ForwardRefExoticComponent<TextFieldContainerProps & import("react").RefAttributes<HTMLDivElement>>;