Key Insight
The "aha" callout. Use it sparingly — once or twice per lesson — for the single line a reader would underline if they were holding a pen. Tinted --cb-accent-muted background, thick --cb-accent left edge, and an iconized accent label so the eye lands on it during a skim.
Preview
Installation
npx shadcn@latest add https://craftbits.dev/r/key-insight.jsonUsage
import { KeyInsight } from "@craft-bits/core";
<KeyInsight>
Attention is just a weighted average. Every other piece of the transformer
machinery is in service of computing the weights well.
</KeyInsight>Custom icon and label:
import { Lightbulb } from "lucide-react";
<KeyInsight icon={<Lightbulb size={10} />} label="Takeaway">
Gradients flow backwards through the same graph the activations flowed forwards through.
</KeyInsight>Anatomy
- Tinted background — a soft
--cb-accent-mutedfill that distinguishes the box from surrounding prose at a glance. - Thick left edge — a 3px
--cb-accentrail (thicker thanAsideorDefinition) — the "this one matters" marker. - Icon badge — a small circular badge holds the icon (default
!). Pass anylucide-reacticon to override. - Label — defaults to
Key insight. Override withlabel="Takeaway"etc., or pass''to drop the heading entirely.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
icon | ReactNode | '!' | Leading mark inside the accent badge. |
label | string | 'Key insight' | Heading text. Pass '' to hide. |
children | ReactNode | required | The insight body. |
className | string | — | Merged onto the root via cn(). |
Accessibility
- Renders as
<aside role="note">so assistive tech announces it as supplementary content. - The icon and badge are
aria-hidden="true"so only the visible label + body are read aloud. - Accent + accent-muted color combinations meet WCAG AA contrast in the default theme; verify with custom palettes.
Credits
- Extracted from:
craftingattention(app/src/lessons/primitives/edu/KeyInsight.tsx).