/
Percival
/
reactJS_course
Обзор
Документация
Войти
/
Percival
/
reactJS_course
Код
Запросы
4
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
task4
task_1_fsd/src/shared/ui/Input/Input.tsx
25 строк
700 B
Rituparn
Added the fourth task
19 окт 2025, 23:09
19 окт 2025, 23:09
f890dd5
Код
Авторство
О чём код?
import { forwardRef } from 'react' import styles from './Input.module.css' interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> { label?: string error?: string } export const Input = forwardRef<HTMLInputElement, InputProps>( ({ label, error, className, ...props }, ref) => { return ( <div className={styles.wrapper}> {label && <label className={styles.label}>{label}</label>} <input ref={ref} className={`${styles.input} ${error ? styles.inputError : ''} ${className || ''}`} {...props} /> {error && <span className={styles.error}>{error}</span>} </div> ) } ) Input.displayName = 'Input'