SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

AnchorHeading

A docs section heading a reader can link to.

Install

Add the package to your Worker, then import the components a page needs.

Configure

Set the scroll margin to your sticky header's height so a jump clears it.

View code
tsx
<Typeset preset="docs">
	<AnchorHeading id="install" linkLabel="Link to Install">Install</AnchorHeading>
	<p>Add the package to your Worker.</p>
	<AnchorHeading id="configure" level={3} linkLabel="Link to Configure">Configure</AnchorHeading>
	<p>Set --ui-docs-scroll-margin to your sticky header's height.</p>
</Typeset>

Demo docs sites

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { AnchorHeading } from "@sdxc/ui/docs";

Renders the heading with its # link after the text. The link stays in the tab order at all times, shows on hover of the heading or on its own focus, and shows always on devices without hover. Jumps clear --ui-docs-scroll-margin (default 5rem).

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
idstringYesFragment the heading answers to, and the # link's target.
levelHeadingLevelNoDefaults to the ambient HeadingScope level, else DEFAULT_LEVEL.
linkLabelstringYesAccessible name of the # link, such as "Link to Install".
childrenRemixNodeYes

Also accepts everything in Omit<TagProps<"h2">, "id">.

@sdxc/ui

Can’t find it? Contact us