<SuspenseList>
Edit this pageSolid 2.0
SuspenseList coordinates Loading boundaries (previously Suspense). This component is still experimental.
SuspenseList allows for coordinating multiple parallel Loading and SuspenseList components. It controls the order in which content is revealed to reduce layout thrashing and has an option to collapse or hide fallback states.
import { SuspenseList } from "solid-js"import type { JSX } from "solid-js"
function SuspenseList(props: { children: JSX.Element revealOrder: "forwards" | "backwards" | "together" tail?: "collapsed" | "hidden"}): JSX.ElementNote: SuspenseList is still in the experimental stage and does not have full SSR support.
Here's an example of how to use SuspenseList:
<SuspenseList revealOrder="forwards" tail="collapsed"> <ProfileDetails user={resource.user} /> <Loading fallback={<h2>Loading posts...</h2>}> <ProfileTimeline posts={resource.posts} /> </Loading> <Loading fallback={<h2>Loading fun facts...</h2>}> <ProfileTrivia trivia={resource.trivia} /> </Loading></SuspenseList>Props
| Name | Type | Default | Description |
|---|---|---|---|
revealOrder | "forwards" | "backwards" | "together" | "forwards" | Determines the order in which the SuspenseList children should be revealed. |
tail | "collapsed" | "hidden" | undefined | Controls how non-revealed fallbacks are displayed. |
revealOrder
"forwards" | "backwards" | "together"
"forwards": Reveals each item in the list once the previous item has finished rendering. This is the default."backwards": Reveals each item in the list once the next item has finished rendering."together": Reveals all items in the list at the same time.
tail
"collapsed" | "hidden"