Reasoning
A collapsed disclosure for the model’s reasoning, closed by default and never announced.
Example
<focsd-reasoning text="The question needs the docs, so search them first."></focsd-reasoning>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/ai';</script>
<focsd-reasoning text="The question needs the docs, so search them first."></focsd-reasoning>import { useEffect, useRef } from 'react';import '@focsd-dev/ai';
export function Example() { const ref = useRef(null); useEffect(() => { const el = ref.current; const handle = (e) => console.log(e.target); el.addEventListener('toggle', handle); return () => el.removeEventListener('toggle', handle); }, []); return <focsd-reasoning ref={ref} text="The question needs the docs, so search them first."></focsd-reasoning>;}<script setup>import '@focsd-dev/ai';</script>
<template> <focsd-reasoning @toggle="onChange" text="The question needs the docs, so search them first."></focsd-reasoning></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/ai';
// template<focsd-reasoning (toggle)="onChange($event)" text="The question needs the docs, so search them first."></focsd-reasoning><script> import '@focsd-dev/ai';</script>
<focsd-reasoning ontoggle={(e) => console.log(e.target)} text="The question needs the docs, so search them first."></focsd-reasoning>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
text | text | string | — |
streaming | streaming | boolean | false |
open | open | boolean | false |
Events
| Event | Description |
|---|---|
toggle | Fired when it opens or closes. Like <details>, it does not bubble. |
CSS parts
Style the inside of the component with ::part(), for example focsd-reasoning::part(summary).
| Part | Description |
|---|---|
summary | The button that opens and closes it. |
body | The reasoning text. |
Accessibility
- A disclosure button named "Reasoning", or "Reasoning…" while it streams. It is collapsed by default.
- Its text is plain text and is never announced as it arrives.
- It fires the
toggleevent when it opens or closes, like<details>, and does not bubble.
Keyboard
| Key | Action |
|---|---|
| Enter / Space | Open or close the reasoning |
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.