Interactive elements

Components•3 min read|
|

Components that respond to reader input: editable variables, tooltips, anchors, changelog entries and copyable prompts.

Editable variables

The wc-var component creates an inline editable field. When the reader changes the value, every {{VAR_NAME}} placeholder on the page updates instantly.

Set your domain:

Set your project:

{ "name": "{{NAME}}", "url": "https://{{DOMAIN}}" } docslit build rsync -avz dist/ deploy@{{DOMAIN}}:/var/www/html/

Click the variable values above and type your own to see both code blocks update.

The variable name. Use UPPER_SNAKE_CASE. Referenced in code blocks as {{NAME}}. The default value shown before the reader edits it. Compile-time form only: <wc-var name="X" value="Y" /> declares a page-level variable. See Variables and precedence. Prevent the reader from editing the value. Use editable variables in quickstart guides and setup pages. Readers type their API key, project name, or domain once and every command on the page becomes copy-paste ready.

Tooltips

Add hover tooltips to provide extra context without cluttering the page. The text is keyboard focusable, Escape closes the tooltip, and it flips to stay on screen.

DocsLit uses <wc-tooltip tip="A lightweight library for building web components">Lit</wc-tooltip> for its component system. Read the <wc-tooltip tip="Every component, attribute and example" headline="Reference" cta="Open reference" href="/0.3/components/callouts-and-alerts" position="bottom">component docs</wc-tooltip>.

DocsLit uses Lit for its component system.

Read the component docs.

The tooltip content. Inline Markdown works. text is accepted as an older alias. A bold line shown before the tip text. Call-to-action link text. It needs href. The URL for the call-to-action link. The preferred side: top, bottom, left or right. It flips automatically when there is no room. Pin the tooltip to dark or light.

Anchors

Create linkable sections with auto-generated IDs:

<wc-anchor>Important section</wc-anchor>

Important section

Hovering over an anchor reveals a link icon. Readers click it to copy the direct URL to that section.

Update entries

Display changelog entries. There are two layouts. The timeline layout uses label, description and tags, and the label doubles as an anchor link. The boxed layout uses version, date and type.

<wc-update label="2026-10-29" description="v1.2.0" tags="Feature, Fix"> New `--json` flag for the `validate` command. </wc-update> <wc-update version="0.2.0" date="November 2026" type="added"> Accordion group component for visually connected collapsible sections. </wc-update> New --json flag for the validate command. Accordion group component for visually connected collapsible sections. The entry label, usually a date or version. It is also the anchor: label="2026-10-29" links as #2026-10-29. Timeline layout. Text under the label, such as a version. Timeline layout. Comma-separated tags shown as chips under the label. Timeline layout. The version number for this change. Boxed layout. The release date, as free text. Boxed layout. The change type badge: added, changed, fixed, removed, deprecated or security. Boxed layout. The anchor id. Defaults to a slug of the label or date. See Anchors. The entry's title in the page RSS feed. Defaults to description, then label, then date. A plain-text summary for the RSS feed. Defaults to a 300-character excerpt of the entry.

Entry anchors

Every wc-update without an id gets one at build time from its label, or its date when it has no label. The id is lowercase, and runs of other characters become -, so "October 28, 2026" becomes october-28-2026. Duplicates on a page get -2, -3 and so on.

Tag filters

When a page has entries that use two or more distinct tags, DocsLit adds filter buttons above the first tagged entry. You don't configure them. Select one or more tags to show the entries that match any of them. Untagged entries are hidden while a filter is on, and Clear resets it. Tags match exactly, including case, so Fix and fix are different tags.

Per-page RSS feed

When url is set in docslit.json, each page that has wc-update entries also gets a <page>.rss.xml file (RSS 2.0) and a <link rel="alternate" type="application/rss+xml"> in its head. It's written for single-version sites and the default version of a versioned site.

Each entry becomes one item, in page order:

Item field Source
Title rss-title, else description, else label, else date
Link The page URL plus # and the entry id
pubDate The label, or the date when there is no label, only if it contains a date with a 4-digit year. "October 28, 2026" qualifies and "1.4.0" doesn't. "Release 2026" counts as 1 January 2026
Categories The entry's tags
Description rss-description, else a plain-text excerpt of the first 300 characters

This feed is separate from the site-level changelog and blog feed, which is built from page frontmatter.

The site-level feed covers pages whose id starts with changelog/ or blog/, which also get RSS and Atom feeds. See What's new for a full example.

Copyable prompts

Style a prompt's parts with ::part(): body, description, actions and copy-button. See Custom CSS.

wc-prompt shows a prompt that readers can copy into an AI assistant, or open directly in one. The text between the tags is what gets copied.

<wc-prompt title="Ask your assistant" actions="claude,chatgpt"> Write a quickstart page for my project using DocsLit components. Run docslit components --json first. </wc-prompt> Write a quickstart page for my project using DocsLit components. Run docslit components --json first.

Use description when the card should show a short summary and the long prompt should stay hidden. The body is then what gets copied and sent:

<wc-prompt title="Migrate my docs" description="Convert a Mintlify project with the importer" icon="sparkles" actions="claude"> Run docslit import ./my-mintlify-docs, then fix everything listed in MIGRATION.md. </wc-prompt> Run docslit import ./my-mintlify-docs, then fix everything listed in MIGRATION.md. The header label. Text shown in the card, with inline Markdown. When set, the body is not shown, but it is still what gets copied. An icon before the title. Defaults to a sparkle. Open-in buttons. A comma-separated list of cursor, claude, chatgpt, claude-code and codex, or a JSON array that can also hold custom objects with label, url and icon. A {prompt} placeholder in url is replaced by the URL-encoded prompt. The Copy button is always there. Truncate the preview to one line. Hide the prompt body and show only the header with its actions.

A custom action uses a JSON array in single quotes:

<wc-prompt actions='[{"label":"Open in Perplexity","url":"https://www.perplexity.ai/search?q={prompt}"}]'> Explain how DocsLit builds a sidebar. </wc-prompt>