{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "line-height-docs",
  "title": "Line Height",
  "description": "Set block line height.",
  "files": [
    {
      "path": "../../content/docs/(plugins)/(styles)/line-height.mdx",
      "content": "---\ntitle: Line Height\ndescription: Set block line height.\ndocs:\n  - route: /docs/examples/line-height\n    title: Line Height Demo\n  - route: /docs/components/line-height-toolbar-button\n    title: Line Height Toolbar Button\n---\n\n`LineHeightPlugin` stores line height on blocks with a `lineHeight` property. Setting the default value removes the property, so saved values only carry overrides.\n\n<ComponentPreview name=\"line-height-demo\" />\n\n<PackageInfo>\n\n## Features\n\n- Block-level `lineHeight` storage.\n- HTML `line-height` style deserialization.\n- Default-value cleanup.\n- Configurable target block types.\n- Shared `setLineHeight` transform.\n- Registry dropdown toolbar driven by valid node values.\n\n</PackageInfo>\n\n## Kit Usage\n\n<Steps>\n\n### Add the Kit\n\nUse `LineHeightKit` for the Plate UI setup. It targets paragraphs and all heading levels, with valid values `1`, `1.2`, `1.5`, `2`, and `3`.\n\n<ComponentSource name=\"line-height-kit\" />\n\n```tsx\nimport { createPlateEditor } from 'platejs/react';\n\nimport { LineHeightKit } from '@/components/editor/plugins/line-height-kit';\n\nexport const editor = createPlateEditor({\n  plugins: [...LineHeightKit],\n});\n```\n\n### Add the Toolbar Control\n\n`LineHeightToolbarButton` reads `defaultNodeValue` and `validNodeValues` from the plugin inject props.\n\n```tsx\nimport { LineHeightToolbarButton } from '@/components/ui/line-height-toolbar-button';\n\nexport function LineHeightControls() {\n  return <LineHeightToolbarButton />;\n}\n```\n\n</Steps>\n\n## Manual Usage\n\n<Steps>\n\n### Install Package\n\n```bash\nnpm install @platejs/basic-styles\n```\n\n### Add the Plugin\n\nConfigure target block types and the values your UI should expose.\n\n```tsx\nimport { LineHeightPlugin } from '@platejs/basic-styles/react';\nimport { KEYS } from 'platejs';\nimport { createPlateEditor } from 'platejs/react';\n\nexport const editor = createPlateEditor({\n  plugins: [\n    LineHeightPlugin.configure({\n      inject: {\n        nodeProps: {\n          defaultNodeValue: 1.5,\n          validNodeValues: [1, 1.2, 1.5, 2, 3],\n        },\n        targetPlugins: [...KEYS.heading, KEYS.p],\n      },\n    }),\n  ],\n});\n```\n\n### Set Line Height\n\nUse the bound transform or the headless utility.\n\n```tsx\nimport { setLineHeight } from '@platejs/basic-styles';\n\neditor.tf.lineHeight.setNodes(2);\n\nsetLineHeight(editor, 1.5, { at: [] });\n```\n\n</Steps>\n\n## Ownership\n\n| Surface | Owner | What It Does |\n|---------|-------|--------------|\n| `BaseLineHeightPlugin` | `@platejs/basic-styles` | Headless plugin that stores `lineHeight`, injects block props, and parses HTML line-height styles. |\n| `LineHeightPlugin` | `@platejs/basic-styles/react` | React wrapper around `BaseLineHeightPlugin`. |\n| `setLineHeight` | `@platejs/basic-styles` | Sets or clears `lineHeight` on matching blocks. |\n| `tf.lineHeight.setNodes` | `@platejs/basic-styles` | Bound transform exposed by the plugin. |\n| `BaseLineHeightKit` | Registry kit | Static/headless setup for paragraphs and headings. |\n| `LineHeightKit` | Registry kit | React setup plus toolbar dependency. |\n| `LineHeightToolbarButton` | Registry UI | Dropdown that writes values through `lineHeight.setNodes`. |\n\nThe package owns line-height storage and parsing. The registry owns the dropdown UI and allowed value list.\n\n## Behavior\n\n| Behavior | Source |\n|----------|--------|\n| Plugin key | `KEYS.lineHeight` |\n| Stored property | `lineHeight` |\n| Default target plugins | `[KEYS.p]` |\n| Registry target plugins | `[...KEYS.heading, KEYS.p]` |\n| Default node value | `1.5` |\n| Registry valid values | `[1, 1.2, 1.5, 2, 3]` |\n| HTML parser | Reads `element.style.lineHeight`. |\n| Setting a custom value | Sets `{ lineHeight: value }` on matching blocks. |\n| Setting the default value | Unsets `lineHeight` on matching blocks. |\n| Non-target blocks | Are ignored by `setLineHeight`. |\n\n## HTML\n\nThe plugin injects an HTML deserializer into each target plugin. When pasted HTML contains an inline `line-height` style on a target block, Plate stores the value on that block.\n\n```html\n<p style=\"line-height: 2\">Readable spacing</p>\n```\n\n## API Reference\n\n| API | Package | Use |\n|-----|---------|-----|\n| `LineHeightPlugin` | `@platejs/basic-styles/react` | React line-height plugin. |\n| `BaseLineHeightPlugin` | `@platejs/basic-styles` | Headless line-height plugin. |\n| `editor.tf.lineHeight.setNodes(value, options?)` | `@platejs/basic-styles` | Sets or clears line height on matching blocks. |\n| `setLineHeight(editor, value, options?)` | `@platejs/basic-styles` | Headless transform behind the bound API. |\n\n## Options\n\n| Option | Surface | Use |\n|--------|---------|-----|\n| `inject.targetPlugins` | `LineHeightPlugin` | Block types that can keep `lineHeight`. |\n| `inject.nodeProps.nodeKey` | `BaseLineHeightPlugin` | Stored block property; defaults to `lineHeight`. |\n| `inject.nodeProps.defaultNodeValue` | `BaseLineHeightPlugin` | Value that clears the stored property when selected. |\n| `inject.nodeProps.validNodeValues` | Registry toolbar | Dropdown values used by `LineHeightToolbarButton`. |\n| `SetNodesOptions` | `setLineHeight` | Slate node update options passed to `setNodes` or `unsetNodes`. |\n",
      "type": "registry:file",
      "target": "content/docs/plate/(plugins)/(styles)/line-height.mdx"
    }
  ],
  "type": "registry:file"
}