# Garis bawah {#underline}

Source: [Garisbawahi teks di editor React · Yurich](https://leeyujoo.com/yurich/id/features/underline/)

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

Package version: `0.1.2`

Beri garis bawah pada teks pilihan.

## Coba sendiri {#try-it}

Pilih “Yurich” dan klik **Garis bawah**. HTML berisi `<u>Yurich</u>`. Klik lagi untuk melepas garis bawah.

## Tambahkan ke editor {#setup}

Aktifkan `Underline` dan hubungkan tombol ke `toggleUnderline`.

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

export function UnderlineEditor() {
  const editor = useEditor({
    extensions: [Underline],
    initialValue: "<p>Beri garis bawah pada 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')}
      >
        Garis bawah
      </button>
      <EditorContent ariaLabel="Editor" />
    </EditorProvider>
  );
}
```

## Perilaku yang perlu diperhatikan {#behavior}

Gunakan `Mod+U` sebagai pintasan. Untuk teks yang membuka URL, gunakan `Link`.

[Fitur](https://leeyujoo.com/yurich/id/features/)
