---
title: "TextStyle extension"
description: "Use the Text Style extension in Tiptap to add tags with custom styles. Learn more in our docs!"
canonical_url: "https://tiptap.dev/docs/editor/extensions/marks/text-style"
---

# TextStyle extension

Use the Text Style extension in Tiptap to add tags with custom styles. Learn more in our docs!

This mark renders a `<span>` HTML tag and enables you to add a list of styling related attributes, for example font-family, font-size, or color. The extension doesn’t add any styling attribute by default, but other extensions use it as the foundation, for example [`FontFamily`](https://tiptap.dev/docs/editor/extensions/functionality/fontfamily.md) or [`Color`](https://tiptap.dev/docs/editor/extensions/functionality/color.md).

> **Interactive demo:** [Textstyle](https://embed.tiptap.dev/preview/Marks/Textstyle)

## Install

```bash
npm install @tiptap/extension-text-style
```

## Commands

### removeEmptyTextStyle()

Remove `<span>` tags without an inline style.

```js
editor.command.removeEmptyTextStyle()
```

## Source code

[packages/extension-text-style/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-text-style/)
