# Type alias ComponentProps<T>

ComponentProps<T>: T extends JSXElementConstructor<infer P>
? P
: T extends keyof IntrinsicElements
? IntrinsicElements[T]
: {}

Used to retrieve the props a component accepts. Can either be passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React component.

It's usually better to use ComponentPropsWithRef or ComponentPropsWithoutRef instead of this type, as they let you be explicit about whether or not to include the `ref` prop.

#### Type Parameters

- T extends keyof IntrinsicElements | JSXElementConstructor<any>

#### See

React TypeScript Cheatsheet

#### Example

    // Retrieves the props an 'input' element accepts
    type InputProps = React.ComponentProps<'input'>;

#### Example

    const MyComponent = (props: { foo: number, bar: string }) => <div />;

    // Retrieves the props 'MyComponent' accepts
    type MyComponentProps = React.ComponentProps<typeof MyComponent>;

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:1653