Skip to content

ClassBrowser

The main container that provides the header, theme CSS injection, copy-as-JSON button, and expand/collapse toggle.

PropTypeRequiredDescription
namestringYesClass, module, or object name
languagestringNoLanguage context (e.g. "lpc", "typescript")
sourcestringNoSource file path shown in the header
typestringNoBadge type: object, module, class, interface
targetstringNoLink URL (external if starts with http)

The default slot accepts any combination of ClassExtends, ClassProperty, ClassMethod, and free-form text/markdown.

  • Theme CSS injection: Resolves highlight colors from your Starlight theme at build time
  • Copy as JSON: Button that serializes the entire class definition to clipboard
  • Expand/collapse all: Toggle button for all method cards
  • Hash navigation: Links like #methodName auto-open and scroll to the target method
  • View transitions: Re-initializes on astro:after-swap for Astro view transitions
<CB.ClassBrowser language="typescript" name="UserService" source="src/services/user.ts" type="class">
Manages user lifecycle operations.
<!-- child components go here -->
</CB.ClassBrowser>