UNPKG

@tiller-ds/form-elements

Version:

Form elements module of Tiller Design System

70 lines (69 loc) 2.63 kB
import * as React from "react"; import { ComponentTokens } from "@tiller-ds/theme"; export declare type TextareaProps = { /** * Custom classes for the container. * Overrides conflicting default styles, if any. * * The provided `className` is processed using `tailwind-merge` to eliminate redundant or conflicting Tailwind classes. */ className?: string; /** * Enables or disables the component's functionality. */ disabled?: boolean; /** * Value passed through from validation indicating to display the error on the component. */ error?: React.ReactNode; /** * The help text displayed below the text area field. */ help?: React.ReactNode; /** * Represents the label above the text area field (not exclusively text). */ label?: React.ReactNode; /** * The accessor value for the text area field component (for validation, fetching, etc.). */ name: string; /** * The placeholder displayed inside the text area field. */ placeholder?: string; /** * Turns this field into a required field in the form. Only applies visual representation (* next to label), * still requires validation on frontend or backend to accompany this value if set to true. */ required?: boolean; /** * Custom class name for the textarea container. */ textareaClassName?: string; /** * A unique identifier for testing purposes. * This identifier can be used in testing frameworks like Jest or Cypress to locate specific elements for testing. * It helps ensure that UI components are behaving as expected across different scenarios. * @type {string} * @example * // Usage: * <MyComponent data-testid="my-component" /> * // In tests: * getByTestId('my-component'); */ "data-testid"?: string; /** * Tooltip icon and text (on icon hover) displayed on the right of the label. */ tooltip?: React.ReactNode; /** * The value of the field sent on submit and/or retrieved on component render (in string format). */ value: string; } & React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & TextareaTokensProps; declare type TextareaTokensProps = { tokens?: ComponentTokens<"Textarea">; }; export default function Textarea({ name, value, label, placeholder, tooltip, help, required, error, disabled, className, textareaClassName, ...props }: TextareaProps): JSX.Element; export {};