Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
how to type props for text area react typescript

I have a react component that looks like this:

import { TextareaHTMLAttributes} from 'react'
import styled from 'styled-components'

const TextAreaElement = styled.textarea`
  border-radius: 40px;
  border: none;
  background: white;
`

const TextArea = (props: TextareaHTMLAttributes<any>) => {  <--- replace <any> here
  return <TextAreaElement {...props} />
}

I know I can do something like this, but would rather not have to add every prop manually:

const TextArea = ({placeholder} : {placeholder: string}) => {
  return <TextAreaElement placeholder={placeholder} />
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can pass the props as regular HTML element

import React from "react";

const CustomTA = (props: React.HTMLProps<HTMLTextAreaElement>) => {
  return <textarea {...props} />;
};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!