Theme

Start Here

Start from the smallest working snippet, then move to interactive examples and the full API contract below.

Styled quick start

Copy this entrypoint first. It includes the imports required to get the component on screen.

svelte
<script lang="ts">
  import '@dryui/ui/themes/default.css';
  import '@dryui/ui/themes/dark.css';
  import { TableOfContents } from '@dryui/ui';
</script>

<TableOfContents.Root>
  <TableOfContents.List>...</TableOfContents.List>
  <TableOfContents.Item>...</TableOfContents.Item>
</TableOfContents.Root>

Import options

Root package

ts
import { TableOfContents } from '@dryui/ui'

Per-component subpath

ts
import { TableOfContents } from '@dryui/ui/table-of-contents'

Customize

Use the interactive examples to see common variants, states, and composition patterns before building your own.

Default

Getting Started

DryUI components are designed to feel production-ready from the first import.

Install the package

Add the package, import the default theme, and start composing wrappers.

Compose the page

Use DryUI layout primitives to build the shell, then layer in navigation and content.

Theme Tokens

Override semantic tokens to match your product palette without rewriting component CSS.

Light and dark mode

Default themes support explicit overrides and system-driven auto mode.

svelte
<TableOfContents.Root selector="[data-toc-demo-content]" headingSelector="h2, h3">
  <TableOfContents.List />
</TableOfContents.Root>

Structure

Compound components always start with TableOfContents.Root. Use this structure block to understand required wrappers before you wire state or styling.

TableOfContents.Root
  TableOfContents.List
  TableOfContents.Item
TableOfContents.Root TableOfContents.ListTableOfContents.Item

Compose

The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.

Compound component. Start with TableOfContents.Root, then add only the parts you need.

TableOfContents.ListTableOfContents.Item

TableOfContents.Root

Prop Type Default Required Bindable
selector
string
'main'
headingSelector
string
'h2
rootMargin
string
'0px 0px -80% 0px'
autoId
boolean
true
children
Snippet

Forwards <element> attributes via rest props. Common examples: id, class, aria-label.

TableOfContents.List

Prop Type Default Required Bindable

Forwards <ol> attributes via rest props. Common examples: id, style, aria-labelledby.

TableOfContents.Item

Prop Type Default Required Bindable
heading
import('@dryui/primitives').TocHeading
children
Snippet<[{ heading: import('@dryui/primitives').TocHeading; active: boolean }]>

Forwards <li> attributes via rest props. Common examples: id, role, value. Omitted: children.