Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readme for the line height control component #25303

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/block-editor/src/components/line-height-control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Line Height Control

The `LineHeightControl` component adds a lineHeight attribute to the core Paragraph and Heading blocks. This allows to update a paragraph line height directly from the block editor interface.

![Line height control in a paragraph block](https://make.wordpress.org/core/files/2020/09/line-height-for-paragraph-block.png)

_Note:_ It is worth noting that the line height setting option is an opt-in feature. [Themes need to declare support for it](https://developer.wordpress.org/block-editor/developers/themes/theme-support/#supporting-custom-line-heights) before it'll be available.

## Table of contents

1. [Development guidelines](#development-guidelines)
2. [Related components](#related-components)

## Development guidelines

### Usage

Renders the markup for the line height setting option in the block inspector.

```jsx
import { KeyboardShortcuts } from '@wordpress/block-editor';
const MyLineHeightControl = () => (
<LineHeightControl value={ lineHeight } onChange={ onChange } />
);
```

### Props

#### `value`

- **Type:** `String` or `Number` or `Undefined`

The value of the line height.

#### `onChange`

- **Type:** `Function`

A callback function that handles the application of the line height value.


## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/provider/README.md) in the components tree.