Thinking
Thinking is a headless disclosure for showing an AI assistant's reasoning or progress trace. It is a native <details> that is closed by default; while the trace is still arriving, streaming marks the root with data-streaming and aria-busy so consumer CSS and assistive technology know it is incomplete.
Status: beta — implemented and unit-tested in the Svelte canonical; ports to the other frameworks pending (2026-10-05)
Implementation Notes
- Renders
<details class="thinking">with<summary class="thinking-summary">{label}</summary>and<div class="thinking-content"> - Closed by default;
openis bindable streamingtrue addsdata-streaming="true"andaria-busy="true"; false omits both attributes- Spreads
restPropsonto the<details>
Props
className: string (default:"") -- CSS class name appended to the base classlabel: string (required) -- summary textopen: boolean (default:false) -- bindablestreaming: boolean (default:false) -- content is still arrivingchildren: slot -- the reasoning content...restProps: unknown -- additional attributes spread onto the<details>
Usage
<Thinking label="Thinking" streaming={isStreaming} bind:open>
<p>Considering the options...</p>
</Thinking>
Keyboard Interactions
- Enter: toggles when the summary has focus (native)
- Space: toggles when the summary has focus (native)
- Tab: moves focus to / from the summary
ARIA
- Native
details/summarydisclosure semantics aria-busy="true"on the root only whilestreaming
When to Use
- Use to reveal an assistant's reasoning without crowding the answer.
- Use when the trace may still be arriving and should be flagged as busy.
- Use when the reasoning is optional reading for most users.
When Not to Use
- Do not use for general supplementary help -- use
details. - Do not use for a custom-controlled toggle -- use
expander. - Do not use for the answer itself -- keep the answer visible.
Headless
This headless component renders native <details> and <summary>. It decides no marker, animation or streaming indicator; those are consumer CSS keyed on [open] and [data-streaming].
Styles
The consumer provides all CSS styling via .thinking, .thinking-summary, .thinking-content and [data-streaming].
Testing
- Verify root
<details class="thinking">withsummary.thinking-summary - Verify closed by default and
openopens it - Verify children render in
.thinking-content - Verify clicking the summary toggles
- Verify
streamingsets and clearsdata-streaming/aria-busy - Verify pass-through attributes
Advice
- Designers: Show a subtle in-progress cue while
data-streamingis set; respect reduced motion. - Developers: Set
streamingfalse when the stream ends soaria-busyis cleared.
Related components
details— a general native disclosurecollapsible— a native-details panel with a summary propexpander— a button-driven disclosureloading— a busy indicator
References
- MDN details element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
- WAI-ARIA Disclosure Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
Lily™ and Lily Design System™ are trademarks.