API Reference

Exports, component props, and type definitions.

Package exports

Import PathExportDescription
jcShowcaseAppMain showcase UI component
jcdefineFixturesFixture plugin factory function
jcJcMetaTypeScript type for meta.json shape
jcFixturePluginTypeScript type for fixture plugins
jc/configdefineConfigConfig factory with autocomplete
jc/configresolveConfigMerges user config with defaults
jc/configdefaultConfigDefault configuration object
jc/nextcreateShowcasePageNext.js App Router page factory

ShowcaseApp props

PropTypeRequiredDescription
metaJcMetaYesExtracted component metadata from meta.json
registryRecord<string, () => Promise<...>>YesLazy component import map from registry.ts
fixturesFixturePlugin[]NoArray of fixture plugins for component-type props
defaultTheme'auto' | 'light' | 'dark'NoInitial theme (default: auto)
defaultViewport'full' | '375' | '768' | '1280'NoInitial viewport width (default: full)

Wrapper detection

Some components must render inside a parent — like AccordionItem inside Accordion. jc detects this from @example JSDoc tags on the component:

tsx
/**
 * A single item within an Accordion.
 *
 * @example
 * <Accordion type="single" collapsible>
 *   <AccordionItem value="1" title="Title">Content</AccordionItem>
 * </Accordion>
 */
export function AccordionItem({ ... }: AccordionItemProps) { ... }

When the example JSX wraps the component in a parent element, jc extracts the wrapper component name and its props. The showcase renders the wrapper automatically around the preview.

Multiple examples

A component can have multiple @example tags. Each becomes a selectable preset in the showcase UI.

Type definitions

ts
interface JcMeta {
  components: ComponentMeta[]
}

interface ComponentMeta {
  displayName: string
  filePath: string
  description?: string
  props: PropMeta[]
  examples?: Example[]
  wrapperComponents?: WrapperComponent[]
}

interface PropMeta {
  name: string
  type: string
  required: boolean
  defaultValue?: string
  description?: string
  enumValues?: string[]
  kind?: 'text' | 'icon' | 'element' | 'node'
}

interface Example {
  name?: string
  props: Record<string, unknown>
  wrapperProps?: Record<string, unknown>
}

interface WrapperComponent {
  name: string
  props: Record<string, unknown>
}