---
title: Interactive elements
description: Add editable variables, tooltips, anchors, changelog updates and copyable AI prompts that respond to reader input.
tag: Components
readtime: 3 min read
---
> For AI agents: the complete documentation index is at [llms.txt](https://docs.docslit.com/0.3/llms.txt). This page as Markdown: [components/interactive-elements.md](https://docs.docslit.com/0.3/components/interactive-elements.md).


# Interactive elements

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: <wc-var name="DOMAIN" default="docs.example.com"></wc-var>

Set your project: <wc-var name="NAME" default="my-product"></wc-var>

```json filename="docslit.json"
{
  "name": "{{NAME}}",
  "url": "https://{{DOMAIN}}"
}
```

```bash
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.

<wc-fields header="wc-var">
<wc-field name="name" type="string" required>
The variable name. Use `UPPER_SNAKE_CASE`. Referenced in code blocks as `{{NAME}}`.
</wc-field>
<wc-field name="default" type="string">
The default value shown before the reader edits it.
</wc-field>
<wc-field name="value" type="string">
Compile-time form only: `<wc-var name="X" value="Y" />` declares a page-level variable. See [Variables and precedence](../writing-content/variables-and-precedence).
</wc-field>
<wc-field name="readonly" type="boolean">
Prevent the reader from editing the value.
</wc-field>
</wc-fields>

<wc-callout type="tip" title="Great for onboarding">
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.
</wc-callout>

## 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.

```markdown
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="callouts-and-alerts" position="bottom">component docs</wc-tooltip>.
```

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="callouts-and-alerts" position="bottom">component docs</wc-tooltip>.

<wc-fields header="wc-tooltip">
<wc-field name="tip" type="string" required>
The tooltip content. Inline Markdown works. `text` is accepted as an older alias.
</wc-field>
<wc-field name="headline" type="string">
A bold line shown before the tip text.
</wc-field>
<wc-field name="cta" type="string">
Call-to-action link text. It needs `href`.
</wc-field>
<wc-field name="href" type="string">
The URL for the call-to-action link.
</wc-field>
<wc-field name="position" type="string" default="top">
The preferred side: `top`, `bottom`, `left` or `right`. It flips automatically when there is no room.
</wc-field>
<wc-field name="theme" type="string">
Pin the tooltip to `dark` or `light`.
</wc-field>
</wc-fields>

## Anchors

Create linkable sections with auto-generated IDs:

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

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

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`.

```markdown
<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>
```

<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>

<wc-fields header="wc-update">
<wc-field name="label" type="string">
The entry label, usually a date or version. It is also the anchor: `label="2026-10-29"` links as `#2026-10-29`. Timeline layout.
</wc-field>
<wc-field name="description" type="string">
Text under the label, such as a version. Timeline layout.
</wc-field>
<wc-field name="tags" type="string">
Comma-separated tags shown as chips under the label. Timeline layout.
</wc-field>
<wc-field name="version" type="string">
The version number for this change. Boxed layout.
</wc-field>
<wc-field name="date" type="string">
The release date, as free text. Boxed layout.
</wc-field>
<wc-field name="type" type="string">
The change type badge: `added`, `changed`, `fixed`, `removed`, `deprecated` or `security`. Boxed layout.
</wc-field>
<wc-field name="id" type="string">
The anchor id. Defaults to a slug of the label or date. See [Anchors](#entry-anchors).
</wc-field>
<wc-field name="rss-title" type="string">
The entry's title in the page RSS feed. Defaults to `description`, then `label`, then `date`.
</wc-field>
<wc-field name="rss-description" type="string">
A plain-text summary for the RSS feed. Defaults to a 300-character excerpt of the entry.
</wc-field>
</wc-fields>

### 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](../changelog/whats-new) for a full example.

## Copyable prompts

Style a prompt's parts with `::part()`: `body`, `description`, `actions` and `copy-button`. See [Custom CSS](../customization/custom-css#component-parts).

`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.

```markdown
<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>
```

<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>

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:

```markdown
<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>
```

<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>

<wc-fields header="wc-prompt">
<wc-field name="title" type="string" default="AI Prompt">
The header label.
</wc-field>
<wc-field name="description" type="string">
Text shown in the card, with inline Markdown. When set, the body is not shown, but it is still what gets copied.
</wc-field>
<wc-field name="icon" type="string">
An [icon](icons) before the title. Defaults to a sparkle.
</wc-field>
<wc-field name="actions" type="string">
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.
</wc-field>
<wc-field name="single-line" type="boolean">
Truncate the preview to one line.
</wc-field>
<wc-field name="hide-prompt" type="boolean">
Hide the prompt body and show only the header with its actions.
</wc-field>
</wc-fields>

A custom action uses a JSON array in single quotes:

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