ApiReference
Structured API reference table — renders prop names, types, defaults, and descriptions with source and required badges.
01 Examples
Rendering a generated prop table
A page's API section
ReferenceSections: it renders the API Reference section around this table and the Types section below it, both from the one componentData you pass, so every type name in the Type column links to a row that exists. Compose ApiReference and TypesReference yourself only for a page that documents several components under one Types section.Prop | Type | Default | Description | |
|---|---|---|---|---|
label required | string | — | Accessible name. Required — an icon-only button has nothing else to announce. | |
onclick | (event: MouseEvent) => void | — | Called when the button is activated by pointer or keyboard. | |
variant variant | 'filled' | 'outlined' | 'ghost' | 'filled' | Visual weight of the button. |
<script lang="ts">
import { ReferenceSections } from '@urbicon-ui/docs';
import { componentData } from './api';
</script>
<ReferenceSections {componentData} />Notes the generator cannot know
<ApiReference props={componentData.props} slotClasses={{ stats: 'hidden' }}>
{#snippet usageNotes()}
<p>Sizes below <code>md</code> are reserved for dense toolbars.</p>
{/snippet}
</ApiReference>02 Accessibility
It is a table, and it says so
The props render through @urbicon-ui/table, so the browser exposes real rows
and columns: a screen reader announces "row 4 of 26, column Type" instead of reading a
wall of divs. Sorting a column updates aria-sort on its header.
Badges are not the only signal
Required props and their source are marked with a badge and with text in the badge, never with colour alone — the required marker reads "required", not a red dot.
Type cross-links
A type that resolves to a local definition renders as a link into the Types section on the same page. It is an ordinary in-page anchor, so it works with the keyboard and appears in the link list a screen reader can bring up.
03 API Reference
8 propsProp | Type | Default | Description | |
|---|---|---|---|---|
props required | ApiProp[] | — | Array of prop definitions to display. | |
class | string | — | Extra classes merged onto the root element. | |
slotClasses | Partial<Record<ApiReferenceSlots, string>> | — | Per-slot class overrides for the wrapper elements. | |
types | Array<{ name: string }> | — | Type entries rendered by a TypesReference on the same page — pass the same
array you pass to <TypesReference types={…} />, or render both tables through
ReferenceSections, which takes the array once for the two of them.
Type names in the Type column that exactly match an entry become in-page links to
it. Omit this (the default) and the column stays plain text: linking is opt-in
precisely because a link is only correct when the target is actually on the page. | |
unstyled | boolean | false | Remove all default tv styles from the wrapper and cell content. | |
usageNotes | Snippet | — | Optional usage notes rendered below the table. | |
...ApiReferenceVariantProps variant | VariantProps | — | Styling variants from ApiReferenceVariantProps | |
...HTMLAttributes<HTMLElement> inherited | HTMLAttributes | — | HTML attributes (excluding: 'children') |
04 Types
Name | Kind | Category | Used by | Description | |
|---|---|---|---|---|---|
ApiProp | interface | helper | 1 | Single prop entry in the API reference table. | |
ApiReferenceProps | interface | props | — | Structured API reference table for component documentation.
Renders props via @urbicon-ui/table with per-column cell snippets
and Badge indicators for source/required status. | |
ApiReferenceSlots | type | variant | — | The slot names slotClasses accepts. |
05 Installation
Import
import { ApiReference } from '@urbicon-ui/docs';