# Подчёркивание {#underline}

Source: [Подчёркивание текста в редакторе React · Yurich](https://leeyujoo.com/yurich/ru/features/underline/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

Добавьте подчёркивание к выделенному тексту.

## Попробуйте {#try-it}

Выделите «Yurich» и нажмите **Подчёркивание**. Вы получите `<u>Yurich</u>`. Нажмите ещё раз, чтобы снять подчёркивание.

## Добавьте в редактор {#setup}

Включите `Underline` и привяжите кнопку к `toggleUnderline`.

```tsx
import { EditorContent, EditorProvider, Underline, useEditor, useIsActive } from 'yurich';

export function UnderlineEditor() {
  const editor = useEditor({
    extensions: [Underline],
    initialValue: "<p>Проведите линию под Yurich.</p>",
  });
  const active = useIsActive(editor, 'toggleUnderline');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleUnderline')}
      >
        Подчёркивание
      </button>
      <EditorContent ariaLabel="Редактор" />
    </EditorProvider>
  );
}
```

## Особенности поведения {#behavior}

Сочетание — `Mod+U`. Для текста, открывающего URL, используйте `Link`.

[Возможности](https://leeyujoo.com/yurich/ru/features/)
