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

Block Editor: Add README for the BlockColorStyleSelector component #68447

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ColorStyleSelector

The ColorStyleSelector component provides a dropdown interface for selecting text and background colors in the block editor. It renders as a toolbar button that, when clicked, reveals a color selection interface for modifying block styles.

## Usage

```jsx
import { BlockColorsStyleSelector } from '@wordpress/block-editor';
import { ColorPalette } from '@wordpress/components';

const MyColorSelectorComponent = () => (
<BlockColorsStyleSelector
TextColor={TextColorComponent}
BackgroundColor={BackgroundColorComponent}
>
<ColorPalette
colors={colors}
onChange={(color) => setAttributes({ textColor: color })}
/>
</BlockColorsStyleSelector>
);
```

## Props

### TextColor

Text color component that wraps icon.

- Type: `Element`
- Required: Yes

### BackgroundColor

Background color component that wraps icon.

- Type: `Element`
- Required: Yes

### children

The content to be displayed within the dropdown panel when the color selector button is clicked.

- Type: `Element`
- Required: No

### className

Class name for component.

- Type: `string`
- Required: No
Loading