Import: import { Show } from "solid-js";
interface ShowProps<T> {
when: T | undefined | null | false;
keyed?: boolean;
fallback?: JSX.Element;
children: JSX.Element | ((accessor: Accessor<T>) => JSX.Element);
}
function Show<T>(props: ShowProps<T>): JSX.Element;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
when |
T | undefined | null | false |
Yes | -- | Condition -- renders children when truthy |
keyed |
boolean |
No | false |
When true, re-renders on reference change (not just truthiness) |
fallback |
JSX.Element |
No | undefined |
Rendered when when is falsy |
children |
JSX.Element | (accessor: Accessor<T>) => JSX.Element |
Yes | -- | Content or render function with narrowed accessor |
- Without
keyed: only truthiness changes trigger show/hide - With
keyed: reference changes trigger full re-render of children - Render function children receive a narrowed
Accessor<T>(guaranteed non-null) - Render function children are wrapped with
untrack-- signals accessed directly inside the callback do not create reactive dependencies
Version: Available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { For } from "solid-js";
function For<T, U extends JSX.Element>(props: {
each: readonly T[];
fallback?: JSX.Element;
children: (item: T, index: () => number) => U;
}): () => U[];| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
each |
readonly T[] |
Yes | -- | Array to iterate |
fallback |
JSX.Element |
No | undefined |
Shown when array is empty |
children |
(item: T, index: () => number) => U |
Yes | -- | Render callback per item |
(item: T, index: () => number) => JSX.Elementitem-- Direct value (T). NOT a signal. Stable reference for objects.index-- Signal (function). MUST call asindex()to read current position.
Keyed by object reference. When an item moves in the array, the DOM node moves with it (no re-creation). Adding/removing items only affects those specific DOM nodes.
Version: Available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { Index } from "solid-js";
function Index<T, U extends JSX.Element>(props: {
each: readonly T[];
fallback?: JSX.Element;
children: (item: () => T, index: number) => U;
}): () => U[];| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
each |
readonly T[] |
Yes | -- | Array to iterate |
fallback |
JSX.Element |
No | undefined |
Shown when array is empty |
children |
(item: () => T, index: number) => U |
Yes | -- | Render callback per index position |
(item: () => T, index: number) => JSX.Elementitem-- Signal (function). MUST call asitem()to read current value.index-- Direct number. NOT a signal. Stable position identifier.
Keyed by array index position. When a value at an index changes, the item signal updates but the DOM node stays in place. Best for primitives where values change but positions are stable.
| Aspect | <For> |
<Index> |
|---|---|---|
item parameter |
Direct value (T) | Signal (() => T) |
index parameter |
Signal (() => number) | Plain number |
| Keyed by | Object reference | Array index position |
| Best for | Objects, reorderable lists | Primitives, form inputs |
Version: Available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { Switch } from "solid-js";
function Switch(props: {
fallback?: JSX.Element;
children: JSX.Element;
}): () => JSX.Element;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
fallback |
JSX.Element |
No | undefined |
Rendered when no <Match> condition is truthy |
children |
JSX.Element |
Yes | -- | One or more <Match> components |
- Evaluates
<Match>children sequentially -- first truthywhenwins - Only ONE
<Match>renders at a time (mutual exclusivity) - When no conditions match and no fallback is provided, renders nothing
Import: import { Match } from "solid-js";
type MatchProps<T> = {
when: T | undefined | null | false;
children: JSX.Element | ((item: T) => JSX.Element);
};
function Match<T>(props: MatchProps<T>): JSX.Element;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
when |
T | undefined | null | false |
Yes | -- | Condition for this branch |
children |
JSX.Element | ((item: T) => JSX.Element) |
Yes | -- | Content or render function with narrowed value |
- MUST be a direct child of
<Switch> - Render function children receive the narrowed truthy value
- Only evaluated when preceding
<Match>conditions are falsy
Version: Switch and Match available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { Dynamic } from "solid-js/web";
function Dynamic<T>(props: T & {
children?: any;
component?: Component<T> | string | keyof JSX.IntrinsicElements;
}): () => JSX.Element;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
component |
Component<T> | string | keyof JSX.IntrinsicElements |
Yes | -- | Component or HTML tag to render |
...rest |
T |
No | -- | All additional props forwarded to rendered component |
- Custom SolidJS components:
component={MyComponent} - HTML tag strings:
component={"div"},component={"button"} - JSX intrinsic element keys: any valid HTML/SVG element name
- All additional props (beyond
component) are forwarded to the rendered component or element - When
componentchanges, the previous component is torn down and a new one is created - When
componentisundefinedornull, nothing renders
Version: Available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { Portal } from "solid-js/web";
function Portal(props: {
mount?: Node;
useShadow?: boolean;
isSVG?: boolean;
children: JSX.Element;
}): Text;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
mount |
Node |
No | document.body |
Target DOM node for portal content |
useShadow |
boolean |
No | false |
Enable Shadow DOM for style isolation |
isSVG |
boolean |
No | false |
Required when mounting into SVG elements |
children |
JSX.Element |
Yes | -- | Content to render in portal |
- Inserts content into a
<div>within the mount target (unlessisSVGis true) - Events propagate through the component tree, not the DOM tree
- Client-side only -- hydration is disabled for portals
- Shadow DOM (
useShadow) encapsulates styles within the portal
Version: Available since Solid 1.0. Stable across 1.x and 2.x.
Import: import { Suspense } from "solid-js";
function Suspense(props: {
fallback?: JSX.Element;
children: JSX.Element;
}): JSX.Element;| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
fallback |
JSX.Element |
No | undefined |
Loading UI shown while resources resolve |
children |
JSX.Element |
Yes | -- | Content shown after all resources resolve |
- Tracks ALL
createResourcecalls within its boundary - DOM nodes are created immediately but NOT attached to the document -- fallback shows instead
- When all resources resolve, children are attached and fallback is removed
onMountandcreateEffectinside Suspense only run AFTER resources resolve- Both branches (fallback + children) exist simultaneously in memory
- Nested Suspense boundaries resolve independently
createResource-- primary trigger for SuspenseSuspenseList-- coordinates multiple Suspense boundaries (ordering)ErrorBoundary-- catches errors thrown by resources
Version: Available since Solid 1.0. Stable across 1.x and 2.x.