TypesReference
Expandable type definitions panel for component documentation, with inline code blocks, literal-value badges and cross-links into the API reference.
Playground
Configure and preview the types panel
01 Type Definitions
Local types used by this component.
Name | Kind | Category | Used by | Description | |
|---|---|---|---|---|---|
ComponentSize | type | helper | 2 | Standard size scale for all components. | |
MintProp | type | helper | — | Micro-interaction animation type. | |
MenuProps | interface | props | — | Props for the Menu select component. |
<TypesReference />01 Examples
How TypesReference renders type definitions
Interface & Type Definitions
01 Button Types
Types extracted from the Button component source.
Name | Kind | Category | Used by | Description | |
|---|---|---|---|---|---|
ButtonVariant | type | variant | 1 | Visual weight of the Button component. | |
ComponentIntent | type | helper | 2 | Semantic color intent shared across all components. | |
ButtonProps | interface | props | — | Props interface for the Button component. |
<TypesReference
id="types-button"
types={sampleTypes}
title="Button Types"
description="Types extracted from the Button component source."
/>02 Empty State
What happens when no types are provided
No Types
01 Types
This component has no local types.
<TypesReference
id="types-empty"
types={[]}
title="Types"
description="This component has no local types."
/>03 Accessibility
A named region with its own heading
The panel renders a <section> labelled by the heading it draws from title, so it is one region in the landmark list rather than an unnamed block
at the end of the page.
Expanding a definition is a button
Each row's toggle carries aria-expanded and is in the tab order with a visible
focus ring. Definitions are collapsed by default, so a keyboard reader passes 20 type names
rather than 20 type bodies.
Cross-links are in-page anchors
The "used by" links point at rows of the API table on the same page. They are ordinary anchors — they work with the keyboard, appear in a link list, and survive being copied out of the page.
Literal values are text, not colour
A union type's members render as badges whose meaning is in their text. Nothing on the panel is distinguished by colour alone.
04 API Reference
13 propsProp | Type | Default | Description | |
|---|---|---|---|---|
types required | LocalTypeDef[] | — | Array of type definitions to display. | |
class | string | — | Extra CSS classes merged onto the root section element. | |
description | string | — | Descriptive text below the title. Unset, it falls back to the localized
typesDescription ("Local type definitions used by this component."),
tagged with its locale's lang; an empty string renders no subtitle at all. | |
emptyState | Snippet | — | Optional snippet rendered below the table when no types match the filter. | |
id | string | 'types' | Anchor id of the rendered <Section>, and the stem its heading id is
derived from ({id}-title). Keep the default on a component page: it is
one half of the anchor pair ApiReference jumps to. A page rendering
several instances gives each its own. | |
marker | boolean | true | Number the section, like <Section marker>: its position among the
numbered sections of the page, so inserting or removing a section
renumbers this one too. false leaves it unstamped.
Inside a CodeExample or PlaygroundConfigurator stage the count is the
stage's own, which starts at 01. | |
meta | string | — | Right-aligned counter in the section header, e.g. "27 types" — the same
slot the API Reference section uses for its prop count. Unset by default:
the toolbar above the table already states the count. | |
size | smmdlg | 'md' | Density of the expanded panel — code block, badges, footnotes. md is the
ApiReference panel's own density, so on a component page both tables
disclose a row alike. It does not reach the heading (that is
<Section intent="secondary">, pinned so the types section reads as a
sibling of the API Reference above it) nor the table rows (pinned to sm,
so both reference tables on a page share one row rhythm). | |
slotClasses | Partial<Record<TypesReferenceSlots, string>> | — | Per-slot class overrides for internal elements. | |
title | string | — | Section heading text. There is no literal default to quote: it falls back
to the localized typesTitle — "Types" in English, "Typen" in German —
tagged with that locale's lang, so it is announced in its own language
inside prose written in another. A title you pass renders as given. | |
unstyled | boolean | false | Strip all default tv() styles from internal slots. | |
...HTMLAttributes<HTMLElement> inherited | HTMLAttributes | — | HTML attributes (excluding: 'children') | |
...TypesReferenceVariantProps variant | VariantProps | — | Styling variants from TypesReferenceVariantProps |
05 Types
Name | Kind | Category | Used by | Description | |
|---|---|---|---|---|---|
TypeUsedByRef | interface | helper | — | Reference to a prop that uses this type. | |
LocalTypeDef | interface | helper | 1 | A local type definition extracted from the component source. | |
TypesReferenceProps | interface | props | — | Displays expandable type definitions extracted from component source, with inline code blocks, literal value badges, and cross-links to the API Reference. | |
TypesReferenceSlots | type | variant | — | The slot names slotClasses accepts. | |
TypesReferenceVariantProps | type | variant | — | — |
06 Installation
Import
import { TypesReference } from '@urbicon-ui/docs';