Steps of an agent run or a reasoning trace, each with a status mark on a line joining them.
Steps of an agent run or a reasoning trace, each with a status mark on a line joining them.
import { ChainOfThought } from 'heroui-native-pro';<ChainOfThought>
<ChainOfThought.Step>
<ChainOfThought.StepTitle>...</ChainOfThought.StepTitle>
<ChainOfThought.StepDescription>...</ChainOfThought.StepDescription>
</ChainOfThought.Step>
</ChainOfThought>status from an enclosing Reasoning, or 'complete' outside one. Renders nothing until it has a visible step.Give each step a status. The line below a settled step is solid. Below an active or pending step it is dashed. The last step has no line.
<ChainOfThought>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Searched the web</ChainOfThought.StepTitle>
<ChainOfThought.StepDescription>12 results</ChainOfThought.StepDescription>
</ChainOfThought.Step>
<ChainOfThought.Step status="active">
<ChainOfThought.StepTitle>Comparing sources</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="pending">
<ChainOfThought.StepTitle>Writing the answer</ChainOfThought.StepTitle>
</ChainOfThought.Step>
</ChainOfThought>A step without a status shows a small neutral dot. complete, active, error, and pending each have their own mark and title style.
<ChainOfThought>
<ChainOfThought.Step>
<ChainOfThought.StepTitle>No status</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Complete</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="active">
<ChainOfThought.StepTitle>Active</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="error">
<ChainOfThought.StepTitle>Error</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="pending">
<ChainOfThought.StepTitle>Pending</ChainOfThought.StepTitle>
</ChainOfThought.Step>
</ChainOfThought>In a stopped or error run, an active step shows as interrupted (a muted square) and pending steps are hidden. Inside a Reasoning, the list takes the Reasoning status. Set status on the list to override it.
<ChainOfThought status="stopped">...</ChainOfThought>Wrap the list in Reasoning for a collapsible "thinking" block. The steps then move with the Reasoning layout transition.
<Reasoning status={isStreaming ? 'streaming' : 'complete'}>
<Reasoning.Trigger />
<Reasoning.Content>
<ChainOfThought>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Read app/layout.tsx</ChainOfThought.StepTitle>
</ChainOfThought.Step>
...
</ChainOfThought>
</Reasoning.Content>
</Reasoning>A node replaces the check of the complete mark. A function draws the whole mark for every status.
<ChainOfThought.Step status="complete" indicator={<GlobeIcon size={12} />}>
<ChainOfThought.StepTitle>Searched the web</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step
status="active"
indicator={({ status }) => <MyMark status={status} />}
>
...
</ChainOfThought.Step>Content other than the title and the description gets extra space above it. String children are wrapped in a Text.
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Generated a design</ChainOfThought.StepTitle>
<Image source={{ uri }} className="aspect-video w-full rounded-xl" />
</ChainOfThought.Step>Screen readers read each step's status before it: "In progress", "Completed", "Failed", "Didn't finish", or "Not started". statusLabel returns your own text. An empty result keeps the built-in one.
<ChainOfThought statusLabel={({ status }) => t(`step.${status}`)}>...</ChainOfThought>import { ChainOfThought, Reasoning } from 'heroui-native-pro';
import { ScrollView } from 'react-native';
export default function ChainOfThoughtExample({
isStreaming = false,
}: {
isStreaming?: boolean;
}) {
const status = isStreaming ? 'streaming' : 'complete';
return (
<ScrollView className="px-5" contentContainerClassName="gap-2 pb-4">
<Reasoning defaultExpanded status={status} duration="2s">
<Reasoning.Trigger />
<Reasoning.Content>
<Reasoning.Text>
The user wants a simple login page. I should read the layout first,
then update the form.
</Reasoning.Text>
</Reasoning.Content>
</Reasoning>
<Reasoning defaultExpanded status={status}>
<Reasoning.Trigger>
<Reasoning.Loader />
<Reasoning.Label>Explore • 2 Files</Reasoning.Label>
<Reasoning.Indicator />
</Reasoning.Trigger>
<Reasoning.Content>
<ChainOfThought>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Read app/layout.tsx</ChainOfThought.StepTitle>
</ChainOfThought.Step>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>Read app/globals.css</ChainOfThought.StepTitle>
</ChainOfThought.Step>
</ChainOfThought>
</Reasoning.Content>
</Reasoning>
<Reasoning defaultExpanded status={status}>
<Reasoning.Trigger>
<Reasoning.Loader />
<Reasoning.Label>Updated layout</Reasoning.Label>
<Reasoning.Indicator />
</Reasoning.Trigger>
<Reasoning.Content>
<ChainOfThought>
<ChainOfThought.Step status="complete">
<ChainOfThought.StepTitle>login-form.tsx</ChainOfThought.StepTitle>
<ChainOfThought.StepDescription>
Updated components/login-form.tsx
</ChainOfThought.StepDescription>
</ChainOfThought.Step>
<ChainOfThought.Step status={isStreaming ? 'active' : 'complete'}>
<ChainOfThought.StepTitle>layout.tsx</ChainOfThought.StepTitle>
<ChainOfThought.StepDescription>
Updated app/layout.tsx
</ChainOfThought.StepDescription>
</ChainOfThought.Step>
</ChainOfThought>
</Reasoning.Content>
</Reasoning>
</ScrollView>
);
}ChainOfThought.Root is an alias of ChainOfThought.
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Steps, usually ChainOfThought.Steps |
status | ChainOfThoughtStatus | Reasoning status, or 'complete' outside one | Run status |
className | string | - | Additional CSS classes for the list column |
statusLabel | ChainOfThoughtStepStatusLabel | - | Returns the spoken status of each step. It is the accessibility label of the mark, so it returns a string |
animation | ChainOfThoughtRootAnimation | - | Animation configuration |
...ViewProps | ViewProps | - | All React Native View props are supported |
| value | description |
|---|---|
streaming | The run is in progress |
complete | The run finished |
stopped | The run was stopped. active steps show as interrupted and pending steps are hidden |
error | The run failed. Same display as stopped |
(renderProps: ChainOfThoughtStepStatusLabelRenderProps) => string | null | undefined. An empty result falls back to the built-in text.
| prop | type | description |
|---|---|---|
defaultLabel | string | Built-in English text, such as "In progress" |
status | 'active' | 'complete' | 'error' | 'pending' | 'interrupted' | Displayed status of the step |
Animation configuration for the list. Can be:
false or "disabled": Disable the steps' layout transition"disable-all": Disable all animations including the step marks and their loaderstrue or undefined: Use default animationsobject: Custom animation configuration| prop | type | default | description |
|---|---|---|---|
state | 'disabled' | 'disable-all' | boolean | - | Disable animations while customizing properties |
layout.value | LayoutTransition | LinearTransition.springify().damping(140).stiffness(1600).mass(4) | Layout transition of the steps. Inside a Reasoning, the steps use the Reasoning transition instead |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Step body. Strings and numbers are wrapped in a Text; other nodes render as-is |
status | 'active' | 'complete' | 'error' | 'pending' | - | Progress of the step. Without it the step shows a neutral dot |
className | string | - | Additional CSS classes for the step row |
classNames | ElementSlots<StepSlots> | - | Additional CSS classes for the slots |
styles | ChainOfThoughtStepStyles | - | Inline styles for the slots |
indicator | ReactNode | ((renderProps: ChainOfThoughtStepIndicatorRenderProps) => ReactNode) | - | A node replaces the check of the complete mark. A function draws the whole mark |
textProps | Omit<TextProps, 'children'> | - | Props of the Text wrapping string and number children |
animation | ChainOfThoughtStepAnimation | - | Mark crossfade configuration |
...ViewProps | ViewProps | - | All React Native View props are supported |
| status | mark | title |
|---|---|---|
| none | Small neutral dot | Foreground at 86% |
complete | Check on a faint disc | Foreground at 86% |
active | Spinning ring on an accent-soft disc | Foreground, medium |
error | Danger cross on a faint disc | Foreground |
pending | Dashed circle | Muted at 80% |
interrupted | Muted square. An active step in a stopped or failed run | Muted |
| prop | type | description |
|---|---|---|
container | string | Step row |
indicator | string | Leading column hosting the mark and the line |
mark | string | 20px box hosting the status mark |
line | string | Line joining the mark to the next step. Not rendered on the last step |
body | string | Column hosting the title, description, and other content |
text | string | Text wrapping string and number children |
| prop | type | description |
|---|---|---|
container | ViewStyle | Styles for the step row |
indicator | ViewStyle | Styles for the leading column |
mark | ViewStyle | Styles for the mark box |
line | ViewStyle | Styles for the line |
body | ViewStyle | Styles for the body column |
text | TextStyle | Styles for the text children Text |
| prop | type | description |
|---|---|---|
status | 'active' | 'complete' | 'error' | 'pending' | 'interrupted' | undefined | Displayed status. undefined for a step without a status |
Animation configuration for the mark crossfade. Can be:
false or "disabled": The mark swaps instantlytrue or undefined: Use default animationsobject: Custom animation configuration| prop | type | default | description |
|---|---|---|---|
state | 'disabled' | boolean | - | Disable animations while customizing properties |
marks.duration | number | 150 | Duration of the crossfade, in milliseconds |
marks.easing | CSSAnimationTimingFunction | cubicBezier(0.22, 1, 0.36, 1) | Timing function of the crossfade |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Title of the step |
className | string | - | Additional CSS classes for the title text |
...TextProps | TextProps | - | All React Native Text props are supported |
| prop | type | default | description |
|---|---|---|---|
children | ReactNode | - | Secondary line of the step |
className | string | - | Additional CSS classes for the description text |
...TextProps | TextProps | - | All React Native Text props are supported |