# Quote Block

- Human documentation: [https://docs.univer.ai/guides/docs/features/quote](https://docs.univer.ai/guides/docs/features/quote)

- Agent Markdown: [https://docs.univer.ai/guides/docs/features/quote.md](https://docs.univer.ai/guides/docs/features/quote.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [docs/features/quote.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/docs/features/quote.mdx)

---

#### Package metadata

```json
{
  "plugins": [
    {
      "client": "@univerjs-pro/docs-quote",
      "facade": "@univerjs-pro/docs-quote/facade"
    },
    {
      "client": "@univerjs-pro/docs-quote-ui",
      "locale": "@univerjs-pro/docs-quote-ui/locale/en-US",
      "style": "@univerjs-pro/docs-quote-ui/lib/index.css"
    }
  ],
  "server": false
}
```

The quote block feature allows you to insert and format quoted text in a document, with visual styling that distinguishes quotes from regular content.

## Introduction

In Univer Docs, quote blocks enable you to:

* **Format quoted text**: Apply distinctive styling to quotations.
* **Nest content**: Include rich content within quote blocks.
* **Easy exit**: Quickly exit quote formatting from empty paragraphs.

## Plugin Mode

### Installation

#### npm

```bash
npm install @univerjs-pro/docs-quote @univerjs-pro/docs-quote-ui
```

#### pnpm

```bash
pnpm add @univerjs-pro/docs-quote @univerjs-pro/docs-quote-ui
```

#### yarn

```bash
yarn add @univerjs-pro/docs-quote @univerjs-pro/docs-quote-ui
```

#### bun

```bash
bun add @univerjs-pro/docs-quote @univerjs-pro/docs-quote-ui
```

### Usage

```typescript
import { UniverDocsQuotePlugin } from '@univerjs-pro/docs-quote' // [!code ++]
import { UniverDocsQuoteUIPlugin } from '@univerjs-pro/docs-quote-ui' // [!code ++]
import DocsQuoteUIEnUS from '@univerjs-pro/docs-quote-ui/locale/en-US' // [!code ++]
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'

import '@univerjs-pro/docs-quote-ui/lib/index.css' // [!code ++]

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: mergeLocales(
      DocsQuoteUIEnUS, // [!code ++]
    ),
  },
})

univer.registerPlugin(UniverDocsQuotePlugin) // [!code ++]
univer.registerPlugin(UniverDocsQuoteUIPlugin) // [!code ++]
```

If you have a commercial license for Univer, please refer to [Using License in Client](https://docs.univer.ai/server/license.md#in-plugin-mode) for configuration.

## Facade API

Make sure to import the facade before using the API:

```typescript
import '@univerjs-pro/docs-quote/facade'
```

### Get All Quote Blocks

```typescript
const doc = univerAPI.getActiveDocument()
const quotes = doc?.getQuotes() ?? []
```

### Insert a Quote Block

```typescript
const doc = univerAPI.getActiveDocument()
const quote = doc?.insertQuote({
  startOffset: 12,
  endOffset: 35,
})
```

### Set the quote line color

```typescript
const quote = univerAPI.getActiveDocument()?.getQuote('quote-block-id')
quote?.setLineColor('#5B5FC7')
```

### Set the quote text color

```typescript
const quote = univerAPI.getActiveDocument()?.getQuote('quote-block-id')
quote?.setTextColor('#242424')
```
