ClassBrowser
The main container that provides the header, theme CSS injection, copy-as-JSON button, and expand/collapse toggle.
| Prop | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Class, module, or object name |
language | string | No | Language context (e.g. "lpc", "typescript") |
source | string | No | Source file path shown in the header |
type | string | No | Badge type: object, module, class, interface |
target | string | No | Link URL (external if starts with http) |
The default slot accepts any combination of ClassExtends, ClassProperty, ClassMethod, and free-form text/markdown.
Features
Section titled “Features”- 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
#methodNameauto-open and scroll to the target method - View transitions: Re-initializes on
astro:after-swapfor Astro view transitions
Example
Section titled “Example”<CB.ClassBrowser language="typescript" name="UserService" source="src/services/user.ts" type="class"> Manages user lifecycle operations. <!-- child components go here --></CB.ClassBrowser>