UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

43 lines (39 loc) 1.29 kB
"use client"; import { createComponent } from "../../core/components/create-component.js"; import { useFieldProps } from "../field/use-field-props.js"; import { useInputBorder } from "../input/use-input-border.js"; import { useInputPropsContext } from "../input/input.js"; import { textareaStyle } from "./textarea.style.js"; import { useTextarea } from "./use-textarea.js"; //#region src/components/textarea/textarea.tsx const { PropsContext: TextareaPropsContext, usePropsContext: useTextareaPropsContext, withContext } = createComponent("textarea", textareaStyle); /** * `Textarea` is a component used to obtain multi-line text input. * * @see https://yamada-ui.com/docs/components/textarea */ const Textarea = withContext("textarea")((props) => { return { rows: 2, ...useInputPropsContext(), ...props }; }, (props) => { const { props: { errorBorderColor, focusBorderColor,...rest }, ariaProps, dataProps, eventProps } = useFieldProps(props); const { getTextareaProps } = useTextarea({ ...ariaProps, ...dataProps, ...eventProps, ...rest }); return { ...useInputBorder({ errorBorderColor, focusBorderColor }), ...getTextareaProps() }; }); //#endregion export { Textarea, TextareaPropsContext, useTextareaPropsContext }; //# sourceMappingURL=textarea.js.map