Skip to Content

Thermal Provider

Thermal context provider: tracks heat and an idle, warming, combustion, cooling or depleted status from window activity, with a timed cool-down. Thermal parts fall back to a warm resting state without it.

View as Markdown
pnpm dlx shadcn add @01orbital/thermal-provider

The example also uses thermal-atoms and thermal-shell. Install them too:

pnpm dlx shadcn add @01orbital/thermal-atoms @01orbital/thermal-shell

Usage

import { ThermalProvider } from "@/components/thermal/thermal-provider"

Anatomy

Thermal Provider is built from 2 parts. In the example they nest like this:

ThermalProvider
  • ThermalProvider: Holds the shared heat state for the thermal parts inside it, such as EmberLayer and ThermalText. By default, activity anywhere in the window (moving the mouse, typing, scrolling or touching) warms it through "WARMING" to "COMBUSTION"; after a pause it moves to "COOLING", then "DEPLETED".
  • ThermalStatusContext: The current thermal status on its own: "IDLE", "WARMING", "COMBUSTION", "COOLING" or "DEPLETED", or null outside a provider. ThermalProvider supplies it, and ThermalShell can override it with its status prop. Read it with useThermalStatus, which falls back to "WARMING".

API reference

ThermalProvider

Holds the shared heat state for the thermal parts inside it, such as EmberLayer and ThermalText. By default, activity anywhere in the window (moving the mouse, typing, scrolling or touching) warms it through "WARMING" to "COMBUSTION"; after a pause it moves to "COOLING", then "DEPLETED".

Read and change the state with useThermal.

Prop

Type

ThermalStatusContext

The current thermal status on its own: "IDLE", "WARMING", "COMBUSTION", "COOLING" or "DEPLETED", or null outside a provider. ThermalProvider supplies it, and ThermalShell can override it with its status prop. Read it with useThermalStatus, which falls back to "WARMING".

It is kept apart from heat, which can change every 200ms during activity, so parts that only read the status, such as EmberLayer and ThermalText, do not re-render on each heat change.

It accepts the HTML attributes of the element it renders.