---
title: "Details extension"
description: "Use the Details extension in Tiptap to enable the HTML tag for showing and hiding content. Learn more in our docs!"
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/editor/extensions/nodes/details.md)

# Details extension

Use the Details extension in Tiptap to enable the HTML tag for showing and hiding content. Learn more in our docs!

The Details extension enables you to use the `<details>` HTML tag in the editor. This is great to show and hide content.

> **Interactive demo:** [Details](https://v2--tiptap-embed.netlify.app/preview/Nodes/Details)

## Install

```bash
npm install @tiptap/extension-details
```

This extension requires the [`DetailsSummary`](https://tiptap.dev/docs/v2/editor/extensions/nodes/details-summary.md) and [`DetailsContent`](https://tiptap.dev/docs/v2/editor/extensions/nodes/details-content.md) node.

## Settings

### persist

Specify if the open status should be saved in the document. Defaults to `false`.

```js
Details.configure({
  persist: true,
})
```

### openClassName

Specifies a CSS class that is set when toggling the content. Defaults to `is-open`.

```js
Details.configure({
  openClassName: 'is-open',
})
```

### HTMLAttributes

Custom HTML attributes that should be added to the rendered HTML tag.

```js
Details.configure({
  HTMLAttributes: {
    class: 'my-custom-class',
  },
})
```

## Commands

### setDetails()

Wrap content in a details node.

```js
editor.commands.setDetails()
```

### unsetDetails()

Unwrap a details node.

```js
editor.commands.unsetDetails()
```
