Types

Component / ComponentProps / FlowComponent / FlowProps / ParentComponent / ParentProps / Ref / ValidComponent / VoidComponent / VoidProps

A general Component has no implicit children prop. If desired, specify one explicitly, e.g. Component<{ name: string; children: Element }>.


Import

import type {
Component,
ComponentProps,
FlowComponent,
FlowProps,
ParentComponent,
ParentProps,
Ref,
ValidComponent,
VoidComponent,
VoidProps,
} from "solid-js";

Component

Type signature

type Component<P extends Record<string, any> = {}> = (props: P) => JSX.Element;

ComponentProps

Takes the props of the passed component and returns its type

Intrinsic element prop extraction is renderer-specific and lives in renderer packages such as @solidjs/web.

Type signature

type ComponentProps<T extends ValidComponent> =
T extends Component<infer P> ? P : never;

FlowComponent

FlowComponent requires a children prop with the specified type. Use this for components where you need a specific child type, typically a function that receives specific argument types.

Type signature

type FlowComponent<
P extends Record<string, any> = {},
C = JSX.Element,
> = Component<FlowProps<P, C>>;

FlowProps

Extend props to require a children prop with the specified type. Use this for components where you need a specific child type, typically a function that receives specific argument types.

Type signature

type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & {
children: C;
};

ParentComponent

ParentComponent allows an optional children prop. Use this for components that you want to accept children.

Type signature

type ParentComponent<P extends Record<string, any> = {}> = Component<
ParentProps<P>
>;

ParentProps

Extend props to allow optional Solid children. Use this for components that you want to accept children.

Type signature

type ParentProps<P extends Record<string, any> = {}> = P & {
children?: JSX.Element;
};

Ref

Type of props.ref, for use in Component or props typing.

Type signature

type Ref<T> = T | ((val: T) => void) | undefined | Ref<T>[];

Examples

Component<{ ref: Ref<Element> }>;

ValidComponent

ValidComponent API reference.

Type signature

type ValidComponent = Component<any>;

VoidComponent

VoidComponent forbids the children prop. Use this to prevent accidentally passing children to components that would silently throw them away.

Type signature

type VoidComponent<P extends Record<string, any> = {}> = Component<
VoidProps<P>
>;

VoidProps

Extend props to forbid the children prop. Use this to prevent accidentally passing children to components that would silently throw them away.

Type signature

type VoidProps<P extends Record<string, any> = {}> = P & { children?: never };

Learn more

Last updated: 9/27/26, 8:11 AMEdit this pageReport an issue with this page